コード例 #1
0
 public CreateModel(TableauxContext context,
                    NamesService namesService,
                    IFichierService fichierService)
 {
     _context        = context;
     _fichierService = fichierService;
 }
コード例 #2
0
        public void Init(Action <OdcmModel> config)
        {
            base.Init(config);

            NavTargetConcreteType = Proxy.GetClass(NavTargetClass.Namespace, NavTargetClass.Name);

            NavTargetConcreteInterface = Proxy.GetInterface(NavTargetClass.Namespace, "I" + NavTargetClass.Name);

            NavTargetFetcherType = Proxy.GetClass(NavTargetClass.Namespace, NavTargetClass.Name + "Fetcher");

            var identifier = NamesService.GetFetcherInterfaceName(NavTargetClass);

            NavTargetFetcherInterface = Proxy.GetInterface(NavTargetClass.Namespace, identifier.Name);

            NavTargetCollectionType = Proxy.GetClass(NavTargetClass.Namespace, NavTargetClass.Name + "Collection");

            identifier = NamesService.GetCollectionInterfaceName(NavTargetClass);
            NavTargetCollectionInterface = Proxy.GetInterface(NavTargetClass.Namespace, identifier.Name);

            NavTargetEntity = new EntityArtifacts()
            {
                Class               = NavTargetClass,
                ConcreteType        = NavTargetConcreteType,
                ConcreteInterface   = NavTargetConcreteInterface,
                FetcherType         = NavTargetFetcherType,
                FetcherInterface    = NavTargetFetcherInterface,
                CollectionType      = NavTargetCollectionType,
                CollectionInterface = NavTargetCollectionInterface
            };
        }
コード例 #3
0
        private void Init(bool isCollection)
        {
            base.Init(m =>
            {
                var @namespace = m.Namespaces[0];
                NavTargetClass = Any.OdcmEntityClass(@namespace);
                @namespace.Types.Add(NavTargetClass);

                m_NavTargetProjection = NavTargetClass.AnyOdcmProjection();
                NavTargetClass.AddProjection(m_NavTargetProjection.Capabilities);

                var @class         = @namespace.Classes.First();
                NavigationProperty = Any.OdcmProperty(p =>
                {
                    p.Class        = @class;
                    p.Projection   = m_NavTargetProjection;
                    p.IsCollection = isCollection;
                });

                m.Namespaces[0].Classes.First().Properties.Add(NavigationProperty);
            });

            var identifier = NamesService.GetFetcherInterfaceName(NavTargetClass, m_NavTargetProjection);

            m_NavTargetFetcherInterface = Proxy.GetInterface(NavTargetClass.Namespace, identifier.Name);

            identifier = NamesService.GetCollectionInterfaceName(NavTargetClass, m_NavTargetProjection);
            m_NavTargetCollectionInterface = Proxy.GetInterface(NavTargetClass.Namespace, identifier.Name);
        }
コード例 #4
0
        public Given_an_OdcmClass_Entity_Derived()
        {
            base.Init(m =>
            {
                var @namespace   = m.Namespaces[0];
                var derivedClass = @namespace.Classes.First();
                _baseClass       = Any.OdcmEntityClass(@namespace);
                @namespace.Types.Add(_baseClass);
                derivedClass.Base = _baseClass;
                if (!_baseClass.Derived.Contains(derivedClass))
                {
                    _baseClass.Derived.Add(derivedClass);
                }
            });

            _baseConcreteType = Proxy.GetClass(_baseClass.Namespace, _baseClass.Name);

            _baseConcreteInterface = Proxy.GetInterface(_baseClass.Namespace, "I" + _baseClass.Name);

            _baseFetcherType = Proxy.GetClass(_baseClass.Namespace, _baseClass.Name + "Fetcher");

            var identifier = NamesService.GetFetcherInterfaceName(_baseClass);

            _baseFetcherInterface = Proxy.GetInterface(_baseClass.Namespace, identifier.Name);

            _toDerivedMethodName = "To" + ConcreteType.Name;
        }
コード例 #5
0
        public Given_an_OdcmClass_Entity_with_multiple_OdcmProjections()
        {
            IEnumerable <OdcmProjection> projections = null;
            OdcmClass targetClass = null;

            base.Init(
                m =>
            {
                targetClass = m.Namespaces[0].Classes.First();
                targetClass.Properties.Add(Any.PrimitiveOdcmProperty(p => p.Class = Class));
                projections = targetClass.AnyOdcmProjections().Distinct().ToList();
                foreach (var projection in projections)
                {
                    targetClass.AddProjection(projection.Capabilities);
                }
            });

            foreach (var projection in projections)
            {
                var identifier = NamesService.GetFetcherInterfaceName(targetClass, projection);
                var fetcher    = Proxy.GetInterface(targetClass.Namespace, identifier.Name);

                identifier = NamesService.GetCollectionInterfaceName(targetClass, projection);
                var collection = Proxy.GetInterface(targetClass.Namespace, identifier.Name);

                var fetcherCollectionTuple = new Tuple <Type, Type>(fetcher, collection);
                m_projectionFetcherCollectionMap.Add(projection, fetcherCollectionTuple);
            }
        }
コード例 #6
0
 public IndexModel(TableauxContext context,
                   NamesService namesService,
                   IFichierService fichierService)
 {
     _context        = context;
     NamesService    = namesService;
     _fichierService = fichierService;
 }
コード例 #7
0
 public CreateMasseModel(NamesService namesService,
                         TableauxContext context,
                         IFichierService fichierService)
 {
     NomService      = namesService;
     _context        = context;
     _fichierService = fichierService;
 }
コード例 #8
0
ファイル: Show.cshtml.cs プロジェクト: Laox23/TableauPeinture
 public ShowModel(IWebHostEnvironment webHostEnvironment,
                  TableauxContext context,
                  IFichierService fichierService,
                  NamesService namesService)
 {
     _context            = context;
     _fichierService     = fichierService;
     _webHostEnvironment = webHostEnvironment;
     _namesService       = namesService;
 }
コード例 #9
0
        public void Init(Action <OdcmModel> config = null, bool generateMocks = false)
        {
            Model = new OdcmModel(Any.ServiceMetadata());

            Namespace = Any.EmptyOdcmNamespace();

            Model.Namespaces.Add(Namespace);

            Class = Any.OdcmEntityClass(Namespace);

            Model.AddType(Class);

            OdcmContainer = Any.ServiceOdcmClass(Namespace);

            Model.AddType(OdcmContainer);

            if (config != null)
            {
                config(Model);
            }

            Model.ServiceMetadata["$metadata"] = Model.ToEdmx(true);

            Proxy = GetProxy(Model, ConfigurationProvider, generateMocks ? new[] { "DynamicProxyGenAssembly2" } : null);

            ConcreteType = Proxy.GetClass(Class.Namespace, Class.Name);

            ConcreteInterface = Proxy.GetInterface(Class.Namespace, "I" + Class.Name);

            FetcherType = Proxy.GetClass(Class.Namespace, Class.Name + "Fetcher");

            var identifier = NamesService.GetFetcherInterfaceName(Class);

            FetcherInterface = Proxy.GetInterface(Class.Namespace, identifier.Name);

            CollectionType = Proxy.GetClass(Class.Namespace, Class.Name + "Collection");

            identifier          = NamesService.GetCollectionInterfaceName(Class);
            CollectionInterface = Proxy.GetInterface(Class.Namespace, identifier.Name);

            EntityContainerType = Proxy.GetClass(Model.EntityContainer.Namespace, Model.EntityContainer.Name);

            EntityContainerInterface = Proxy.GetInterface(Model.EntityContainer.Namespace, "I" + Model.EntityContainer.Name);

            TargetEntity = new EntityArtifacts()
            {
                Class               = Class,
                ConcreteType        = ConcreteType,
                ConcreteInterface   = ConcreteInterface,
                FetcherType         = FetcherType,
                FetcherInterface    = FetcherInterface,
                CollectionType      = CollectionType,
                CollectionInterface = CollectionInterface
            };
        }
コード例 #10
0
        public VoiceController(IHostingEnvironment hostingEnvironment, IOptions <TwilioAppConfig> twilioOptions, IOptions <DirectlineConfig> directlineOptions, TextToSpeech textToSpeech, NamesService namesService)
        {
            _namesService       = namesService;
            _textToSpeech       = textToSpeech;
            _twilioAppConfig    = twilioOptions.Value;
            _directlineConfig   = directlineOptions.Value;
            _hostingEnvironment = hostingEnvironment;

            TwilioClient.Init(_twilioAppConfig.TwilioSid, _twilioAppConfig.TwilioToken);
            Init();
        }
コード例 #11
0
 public IndexModel(IWebHostEnvironment webHostEnvironment,
                   TableauxContext context,
                   IFichierService fichierService,
                   NamesService namesService,
                   UserManager <Utilisateur> userManager)
 {
     _context            = context;
     _fichierService     = fichierService;
     _webHostEnvironment = webHostEnvironment;
     _namesService       = namesService;
     _userManager        = userManager;
 }
        public void The_EntityContainer_class_has_the_renamed_property()
        {
            bool isCollection = _property.IsCollection;
            var  propertyType = _property.Projection.Type;
            var  identifier   = isCollection
                ? NamesService.GetCollectionInterfaceName(propertyType)
                : NamesService.GetFetcherInterfaceName(propertyType);

            EntityContainerType.Should().HaveProperty(
                CSharpAccessModifiers.Public,
                isCollection ? (CSharpAccessModifiers?)null : CSharpAccessModifiers.Private,
                Proxy.GetInterface(_property.Type.Namespace, identifier.Name),
                GetPascalCaseName(_property));
        }
コード例 #13
0
        public void When_ForcePropertyPascalCasing_is_true_then_all_properties_are_Pascal_Cased()
        {
            CamelCaseAllModelProperties();

            var configMock = new Mock <IConfigurationProvider>(MockBehavior.Loose);


            configMock
            .Setup(c => c.GetConfiguration <CSharpWriterSettings>())
            .Returns(() => new CSharpWriterSettings
            {
                ForcePropertyPascalCasing = true
            });

            var proxy = GetProxy(_model, configMock.Object);

            foreach (var ns in _model.Namespaces)
            {
                foreach (var @class in ns.Classes)
                {
                    var cl = @class;

                    var propertyNames = proxy.GetClass(ns.Name, cl.Name)
                                        .Properties()
                                        .Select(p => p.Name.Substring(p.Name.LastIndexOf('.') + 1)).ToList();

                    if (cl.Kind != OdcmClassKind.Service)
                    {
                        propertyNames.Should().Contain(
                            cl.Properties.Select(p => p.Name).Where(n => n[0] != '_'),
                            because: "Because Complex and Entity Types should have obsoleted properties with original names.");
                    }

                    if (cl.Kind == OdcmClassKind.Entity)
                    {
                        var fetcherInterface = NamesService.GetFetcherInterfaceName(cl);
                        proxy.GetInterface(ns.Name, fetcherInterface.Name)
                        .Properties()
                        .Select(p => p.Name.Substring(p.Name.LastIndexOf('.') + 1))
                        .Should().Contain(cl.NavigationProperties().Select(GetPascalCaseName).Where(n => n[0] != '_'), because: "Because the fetcher's navigation properties should be capitalized.")
                        .And.NotContain(cl.NavigationProperties().Select(p => p.Name).Where(n => n[0] != '_'), because: "Because the fetcher should not have obsoleted properties.");
                    }

                    propertyNames.Should()
                    .Contain(cl.Properties.Select(GetPascalCaseName).Where(n => n[0] != '_'), because: "Because all generated classes should have Pascal-Cased properties.");
                }
            }
        }
コード例 #14
0
        public void When_Navigation_OdcmProperty_has_Description_then_fetcher_interface_property_has_the_right_summary_tag()
        {
            var property = Any.EntityOdcmProperty(_namespace, p => p.Description = Any.Paragraph(Any.Int(10, 20)));
            var @class   = Any.OdcmEntityClass(_namespace, c => c.Properties.Add(property));

            property.Class = @class;
            _model.AddType(@class);
            _model.AddType(property.Type);
            var    fetcherInterface = NamesService.GetFetcherInterfaceName(@class);
            string propertyName     = string.Format("P:{0}.{1}.{2}", @class.Namespace.Name, fetcherInterface.Name, property.Name);

            var xmlContent = GetProxyXmlDocumentContent(_model);
            var summary    = GetSummary(xmlContent, propertyName);

            summary
            .Should()
            .BeEquivalentTo(property.Description, "OdcmProperty.Description should be captured as C# document comment for fetcher interface property");
        }
コード例 #15
0
        public void When_OdcmMethod_has_Description_then_fetcher_interface_method_has_the_right_summary_tag()
        {
            var method = Any.OdcmMethod(m =>
            {
                m.Description = Any.Paragraph(Any.Int(10, 20));
                m.Parameters.Clear();
            });
            var @class = Any.OdcmEntityClass(_namespace, c => c.Methods.Add(method));

            _model.AddType(@class);

            var    xmlContent       = GetProxyXmlDocumentContent(_model);
            var    fetcherInterface = NamesService.GetFetcherInterfaceName(@class);
            string methodName       = string.Format("M:{0}.{1}.{2}Async", @class.Namespace.Name, fetcherInterface.Name, method.Name);
            var    summary          = GetSummary(xmlContent, methodName);

            summary
            .Should()
            .BeEquivalentTo(method.Description, "OdcmMethod.Description should be captured as C# document comment for fetcher interface method");
        }
コード例 #16
0
        private void Init(OdcmProjection projection)
        {
            base.Init(
                m =>
            {
                m_TargetClass = m.Namespaces[0].Classes.First();
                m_TargetClass.Properties.Add(Any.PrimitiveOdcmProperty(p => p.Class = Class));

                projection.Type = m_TargetClass;

                m_TargetClass.AddProjection(projection.Capabilities);
            });


            var identifier = NamesService.GetFetcherInterfaceName(m_TargetClass, projection);

            m_FetcherInterface = Proxy.GetInterface(m_TargetClass.Namespace, identifier.Name);

            identifier            = NamesService.GetCollectionInterfaceName(m_TargetClass, projection);
            m_CollectionInterface = Proxy.GetInterface(m_TargetClass.Namespace, identifier.Name);
        }
コード例 #17
0
 public ValuesController(NamesService namesService)
 {
     this.namesService = namesService;
 }
コード例 #18
0
        private static void PerformFormattedNameAnalysis(AdoClientService adoClientService)
        {
            var namesService = new NamesService(adoClientService);

            namesService.Analyze();
        }