本文整理汇总了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);
}
}
示例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)");
}
}
示例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);
}
}
示例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));
}
}
示例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"));
}
}
示例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;
}