本文整理汇总了C#中System.Data.Entity.Core.Metadata.Edm.EntityContainer类的典型用法代码示例。如果您正苦于以下问题:C# EntityContainer类的具体用法?C# EntityContainer怎么用?C# EntityContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EntityContainer类属于System.Data.Entity.Core.Metadata.Edm命名空间,在下文中一共展示了EntityContainer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Visit
protected virtual void Visit(EntityContainer entityContainer)
{
foreach (var set in entityContainer.BaseEntitySets)
{
Visit(set);
}
}
示例2: VisitEdmEntityContainer_visits_function_imports
public void VisitEdmEntityContainer_visits_function_imports()
{
var functionPayload =
new EdmFunctionPayload
{
IsFunctionImport = true
};
var functionImport =
new EdmFunction("f", "N", DataSpace.CSpace, functionPayload);
var container = new EntityContainer("C", DataSpace.CSpace);
container.AddFunctionImport(functionImport);
var visitorMock =
new Mock<EdmModelVisitor>
{
CallBase = true
};
visitorMock.Object.VisitEdmModel(new EdmModel(container));
visitorMock.Verify(v => v.VisitFunctionImports(container, It.IsAny<IEnumerable<EdmFunction>>()), Times.Once());
visitorMock.Verify(v => v.VisitFunctionImport(functionImport), Times.Once());
}
示例3: WriteMappingFragment_should_write_store_entity_set_name
public void WriteMappingFragment_should_write_store_entity_set_name()
{
var fixture = new Fixture();
var entityType = new EntityType("E", "N", DataSpace.CSpace);
var entitySet = new EntitySet("ES", "S", null, null, entityType);
var entityContainer = new EntityContainer("EC", DataSpace.SSpace);
entityContainer.AddEntitySetBase(entitySet);
var storageEntitySetMapping
= new EntitySetMapping(
entitySet,
new EntityContainerMapping(entityContainer));
TypeMapping typeMapping = new EntityTypeMapping(storageEntitySetMapping);
var mappingFragment = new MappingFragment(entitySet, typeMapping, false);
fixture.Writer.WriteMappingFragmentElement(mappingFragment);
Assert.Equal(
@"<MappingFragment StoreEntitySet=""ES"" />",
fixture.ToString());
}
示例4: Can_clear_modification_function_mappings
public void Can_clear_modification_function_mappings()
{
var entityType = new EntityType("E", "N", DataSpace.CSpace);
var entitySet = new EntitySet("S", "N", null, null, entityType);
var function = new EdmFunction("F", "N", DataSpace.SSpace, new EdmFunctionPayload());
var container = new EntityContainer("C", DataSpace.CSpace);
container.AddEntitySetBase(entitySet);
var entitySetMapping =
new StorageEntitySetMapping(
entitySet,
new StorageEntityContainerMapping(container));
var functionMapping =
new StorageModificationFunctionMapping(
entitySet,
entityType,
function,
Enumerable.Empty<StorageModificationFunctionParameterBinding>(),
null,
null);
var entityFunctionMappings =
new StorageEntityTypeModificationFunctionMapping(entityType, functionMapping, null, null);
entitySetMapping.AddModificationFunctionMapping(entityFunctionMappings);
Assert.Equal(1, entitySetMapping.ModificationFunctionMappings.Count());
entitySetMapping.ClearModificationFunctionMappings();
Assert.Equal(0, entitySetMapping.ModificationFunctionMappings.Count());
}
示例5: Can_set_and_get_name
public void Can_set_and_get_name()
{
var entityContainer
= new EntityContainer("Foo", DataSpace.CSpace);
Assert.Equal("Foo", entityContainer.Name);
}
示例6: EdmModel
private EdmModel(EntityContainer entityContainer, double version = XmlConstants.SchemaVersionLatest)
{
DebugCheck.NotNull(entityContainer);
_container = entityContainer;
SchemaVersion = version;
}
示例7: EdmModel
public EdmModel(EntityContainer entityContainer, double version = XmlConstants.SchemaVersionLatest)
{
Check.NotNull(entityContainer, "entityContainer");
_dataSpace = entityContainer.DataSpace;
_containers.Add(entityContainer);
SchemaVersion = version;
}
示例8: Custom_container_set_correctly
public void Custom_container_set_correctly()
{
var container = new EntityContainer("MyContainer", DataSpace.CSpace);
Assert.Same(
container,
new EdmModel(container).Containers.Single());
}
示例9: TryGetEntityContainer
internal bool TryGetEntityContainer(EntitySetBase item, out EntityContainer container)
{
if (item != null)
{
return itemToContainerMap.TryGetValue(item, out container);
}
container = null;
return false;
}
示例10: TryGetEntityContainer
// <summary>
// Returns the entity container in CSpace or SSpace
// </summary>
internal override bool TryGetEntityContainer(string name, bool ignoreCase, out EntityContainer entityContainer)
{
if (!base.TryGetEntityContainer(name, ignoreCase, out entityContainer))
{
return _modelPerspective.TryGetEntityContainer(name, ignoreCase, out entityContainer);
}
return true;
}
示例11: Type
/// <summary>
/// Gets the type identifier for the specified container.
/// </summary>
/// <param name="container">The container.</param>
/// <returns>The identifier.</returns>
public string Type(EntityContainer container)
{
if (container == null)
{
throw new ArgumentNullException("container");
}
return Identifier(container.Name);
}
示例12: Can_get_collection_of_association_sets
public void Can_get_collection_of_association_sets()
{
var entityContainer = new EntityContainer("C", DataSpace.CSpace);
entityContainer.AddEntitySetBase(new AssociationSet("A", new AssociationType("A", XmlConstants.ModelNamespace_3, false, DataSpace.CSpace)));
Assert.Equal(1, entityContainer.AssociationSets.Count);
Assert.Empty(entityContainer.EntitySets);
}
示例13: Can_get_collection_of_entity_sets
public void Can_get_collection_of_entity_sets()
{
var entityContainer = new EntityContainer("C", DataSpace.CSpace);
entityContainer.AddEntitySetBase(new EntitySet("E", null, null, null, new EntityType("E", "N", DataSpace.CSpace)));
Assert.Equal(1, entityContainer.EntitySets.Count);
Assert.Empty(entityContainer.AssociationSets);
}
示例14: Can_get_store_and_entity_containers
public void Can_get_store_and_entity_containers()
{
var entityContainer = new EntityContainer("C", DataSpace.CSpace);
var storeContainer = new EntityContainer("S", DataSpace.CSpace);
var entityContainerMapping =
new EntityContainerMapping(entityContainer, storeContainer, null, false, false);
Assert.Same(entityContainer, entityContainerMapping.EdmEntityContainer);
Assert.Same(storeContainer, entityContainerMapping.StorageEntityContainer);
}
示例15: Can_set_and_get_name
public void Can_set_and_get_name()
{
var entityContainer
= new EntityContainer
{
Name = "Foo"
};
Assert.Equal("Foo", entityContainer.Name);
}