当前位置: 首页>>代码示例>>C#>>正文


C# ContainerBuilder.UseDatenMeisterDotNet方法代码示例

本文整理汇总了C#中Autofac.ContainerBuilder.UseDatenMeisterDotNet方法的典型用法代码示例。如果您正苦于以下问题:C# ContainerBuilder.UseDatenMeisterDotNet方法的具体用法?C# ContainerBuilder.UseDatenMeisterDotNet怎么用?C# ContainerBuilder.UseDatenMeisterDotNet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Autofac.ContainerBuilder的用法示例。


在下文中一共展示了ContainerBuilder.UseDatenMeisterDotNet方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestWithMetaClass

        public void TestWithMetaClass()
        {
            var kernel = new ContainerBuilder();
            var builder = kernel.UseDatenMeisterDotNet(new IntegrationSettings { PathToXmiFiles = "Xmi" });
            using (var scope = builder.BeginLifetimeScope())
            {
                var dataLayerLogic = scope.Resolve<IDataLayerLogic>();
                var dataLayers = scope.Resolve<DataLayers>();
                var umlDataLayer = dataLayers.Uml;
                var uml = dataLayerLogic.Get<_UML>(umlDataLayer);
                Assert.That(uml, Is.Not.Null);

                var extent = new XmlUriExtent("dm:///test");
                extent.Workspaces = scope.Resolve<IWorkspaceCollection>();
                dataLayerLogic.AssignToDataLayer(extent, dataLayers.Types);

                var factory = scope.Resolve<IFactoryMapper>().FindFactoryFor(scope, extent);

                var interfaceClass = uml.SimpleClassifiers.__Interface;
                var element = factory.create(interfaceClass);
                Assert.That(element, Is.Not.Null);

                extent.elements().add(element);
                Assert.That(extent.elements().size(), Is.EqualTo(1));

                var retrievedElement = extent.elements().ElementAt(0) as IElement;
                Assert.That(retrievedElement, Is.Not.Null);
                Assert.That(retrievedElement.getMetaClass(), Is.Not.Null);
                Assert.That(retrievedElement.metaclass, Is.Not.Null);
                var foundMetaClass = retrievedElement.metaclass;
                Assert.That(foundMetaClass.Equals(interfaceClass), Is.True);
            }
        }
开发者ID:mbrenn,项目名称:datenmeister-new,代码行数:33,代码来源:ExtentTests.cs

示例2: TestGeneralizedProperties

        public void TestGeneralizedProperties()
        {
            var kernel = new ContainerBuilder();
            kernel.RegisterSource(new AnyConcreteTypeNotAlreadyRegisteredSource());
            var builder = kernel.UseDatenMeisterDotNet(new IntegrationSettings { PathToXmiFiles = "Xmi" });
            using (var scope = builder.BeginLifetimeScope())
            {
                var classifierMethods = scope.Resolve<ClassifierMethods>();
                classifierMethods.Legacy = false;
                var dataLayers = scope.Resolve<DataLayers>();
                var dataLayerLogic = scope.Resolve<DataLayerLogic>();

                // Gets the logic
                var uml = dataLayerLogic.Get<_UML>(dataLayers.Uml);
                var feature = uml.Classification.__Feature;
                var properties = classifierMethods.GetPropertiesOfClassifier(feature).ToList();

                Assert.That(properties.Contains(_UML._Classification._Feature.isStatic), Is.True,
                    "isStatic");
                Assert.That(properties.Contains(_UML._Classification._RedefinableElement.isLeaf), Is.True,
                    "isLeaf (Parent)");
                Assert.That(properties.Contains(_UML._CommonStructure._NamedElement.name), Is.True,
                    "name (Parent of Parent)");
            }
        }
开发者ID:mbrenn,项目名称:datenmeister-new,代码行数:25,代码来源:TestUmlMethods.cs

示例3: TestFactoryMappingByAttributeForExtentLoaders

        public void TestFactoryMappingByAttributeForExtentLoaders()
        {
            var kernel = new ContainerBuilder();
            var builder = kernel.UseDatenMeisterDotNet(new IntegrationSettings {PathToXmiFiles = "Xmi"});
            using (var scope = builder.BeginLifetimeScope())
            {

                var mapper = new ManualConfigurationToExtentStorageMapper();
                mapper.PerformMappingForConfigurationOfExtentLoaders();

                Assert.That(mapper.HasMappingFor(typeof(CSVStorageConfiguration)), Is.True);
                Assert.That(mapper.HasMappingFor(typeof(CSVDataProvider)), Is.False);
            }
        }
开发者ID:mbrenn,项目名称:datenmeister-new,代码行数:14,代码来源:TestIntegration.cs

示例4: TestCreatabeTypes

        public void TestCreatabeTypes()
        {
            var kernel = new ContainerBuilder();
            var builder = kernel.UseDatenMeisterDotNet(new IntegrationSettings {PathToXmiFiles = "Xmi"});
            using (var scope = builder.BeginLifetimeScope())
            {
                // Apply for zipcodes
                var integrateZipCodes = scope.Resolve<Integrate>();
                integrateZipCodes.Into(scope.Resolve<IWorkspaceCollection>().FindExtent("dm:///types"));

                var extentFunctions = scope.Resolve<ExtentFunctions>();
                var dataLayers = scope.Resolve<DataLayers>();

                var dataExtent = new MofUriExtent("dm:///test");
                var creatableTypes = extentFunctions.GetCreatableTypes(dataExtent);
                Assert.That(creatableTypes, Is.Not.Null);
                Assert.That(creatableTypes.MetaLayer, Is.EqualTo(dataLayers.Types));
                Assert.That(creatableTypes.CreatableTypes.Count, Is.EqualTo(1));
            }
        }
开发者ID:mbrenn,项目名称:datenmeister-new,代码行数:20,代码来源:ComplexExtentTests.cs

示例5: TestXmlExtentStorage

        public void TestXmlExtentStorage()
        {
            var kernel = new ContainerBuilder();

            var builder = kernel.UseDatenMeisterDotNet(new IntegrationSettings { PathToXmiFiles = "Xmi" });
            using (var scope = builder.BeginLifetimeScope())
            {
                var path = Path.Combine(
                    Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
                    $"testing{new Random().Next(0, 100000)}.xml");
                if (File.Exists(path))
                {
                    File.Delete(path);
                }

                var storageConfiguration = new XmiStorageConfiguration
                {
                    ExtentUri = "dm:///test",
                    Path = path,
                    Workspace = "Data"
                };

                // Creates the extent
                var loader = scope.Resolve<IExtentStorageLoader>();
                var loadedExtent = loader.LoadExtent(storageConfiguration, true);
                Assert.That(loadedExtent, Is.TypeOf<XmlUriExtent>());

                // Includes some data
                var factory = scope.Resolve<IFactoryMapper>().FindFactoryFor(scope, loadedExtent);
                var createdElement = factory.create(null);
                Assert.That(createdElement, Is.TypeOf<XmlElement>());
                loadedExtent.elements().add(createdElement);

                createdElement.set("test", "Test");
                Assert.That(createdElement.get("test"), Is.EqualTo("Test"));

                // Stores the extent
                loader.StoreExtent(loadedExtent);

                // Detaches it
                loader.DetachExtent(loadedExtent);

                // Reloads it
                storageConfiguration.ExtentUri = "dm:///test_new";

                var newExtent = loader.LoadExtent(storageConfiguration, false);
                Assert.That(newExtent.elements().size(), Is.EqualTo(1));
                Assert.That((newExtent.elements().ElementAt(0) as IElement).get("test"), Is.EqualTo("Test"));
            }
        }
开发者ID:mbrenn,项目名称:datenmeister-new,代码行数:50,代码来源:ExtentTests.cs

示例6: CreateKernel

        private IContainer CreateKernel(IAppBuilder app)
        {
            var settings = new IntegrationSettings
            {
                PathToXmiFiles = "App_Data/Xmi",
                EstablishDataEnvironment = true
            };

            var kernel = new ContainerBuilder();
            var container = kernel.UseDatenMeisterDotNet(settings);

            // Defines the shutdown
            var properties = new AppProperties(app.Properties);
            var token = properties.OnAppDisposing;
            token.Register(() =>
            {
                _lifetimeScope.UnuseDatenMeister();
            });

            return container;
        }
开发者ID:mbrenn,项目名称:datenmeister-new,代码行数:21,代码来源:WebserverStartup.cs


注:本文中的Autofac.ContainerBuilder.UseDatenMeisterDotNet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。