本文整理汇总了C#中System.Data.Entity.Core.Metadata.Edm.EntityContainer类的典型用法代码示例。如果您正苦于以下问题:C# EntityContainer类的具体用法?C# EntityContainer怎么用?C# EntityContainer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EntityContainer类属于System.Data.Entity.Core.Metadata.Edm命名空间,在下文中一共展示了EntityContainer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Visit
protected virtual void Visit(EntityContainer entityContainer)
{
foreach (var set in entityContainer.BaseEntitySets)
{
Visit(set);
}
}
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:7,代码来源:basemetadatamappingvisitor.cs
示例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());
}
开发者ID:christiandpena,项目名称:entityframework,代码行数:25,代码来源:EdmModelVisitorTests.cs
示例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());
}
开发者ID:jesusico83,项目名称:Telerik,代码行数:25,代码来源:MslXmlSchemaWriterTests.cs
示例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());
}
开发者ID:christiandpena,项目名称:entityframework,代码行数:34,代码来源:StorageEntitySetMappingTests.cs
示例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);
}
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:7,代码来源:EntityContainerTests.cs
示例6: EdmModel
private EdmModel(EntityContainer entityContainer, double version = XmlConstants.SchemaVersionLatest)
{
DebugCheck.NotNull(entityContainer);
_container = entityContainer;
SchemaVersion = version;
}
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:7,代码来源:EdmModel.cs
示例7: EdmModel
public EdmModel(EntityContainer entityContainer, double version = XmlConstants.SchemaVersionLatest)
{
Check.NotNull(entityContainer, "entityContainer");
_dataSpace = entityContainer.DataSpace;
_containers.Add(entityContainer);
SchemaVersion = version;
}
开发者ID:christiandpena,项目名称:entityframework,代码行数:8,代码来源:EdmModel.cs
示例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());
}
开发者ID:christiandpena,项目名称:entityframework,代码行数:8,代码来源:EdmModelTests.cs
示例9: TryGetEntityContainer
internal bool TryGetEntityContainer(EntitySetBase item, out EntityContainer container)
{
if (item != null)
{
return itemToContainerMap.TryGetValue(item, out container);
}
container = null;
return false;
}
开发者ID:jwanagel,项目名称:jjwtest,代码行数:9,代码来源:EdmModelParentMap.cs
示例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;
}
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:12,代码来源:TargetPerspective.cs
示例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);
}
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:14,代码来源:CodeHelper.cs
示例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);
}
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:9,代码来源:EntityContainerTests.cs
示例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);
}
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:9,代码来源:EntityContainerTests.cs
示例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);
}
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:10,代码来源:EntityContainerMappingTests.cs
示例15: Can_set_and_get_name
public void Can_set_and_get_name()
{
var entityContainer
= new EntityContainer
{
Name = "Foo"
};
Assert.Equal("Foo", entityContainer.Name);
}
开发者ID:jwanagel,项目名称:jjwtest,代码行数:10,代码来源:EntityContainerTests.cs
示例16: DbMapping
public DbMapping(DbContext context)
{
_context = context;
var objectContext = ((IObjectContextAdapter)context).ObjectContext;
_metadataWorkspace = objectContext.MetadataWorkspace;
_codeFirstEntityContainer = _metadataWorkspace.GetEntityContainer("CodeFirstDatabase", DataSpace.SSpace);
MapDb();
}
开发者ID:arthuryii,项目名称:WhenEntityFrameworkMeetUnity,代码行数:11,代码来源:DbMapping.cs
示例17: GetIsTypeOfMappingsForEntitySetAndType
/// <summary>
/// Returns mappings for the given set/type only if the mapping applies also to childEntittyType either via IsTypeOf or explicitly specifying multiple types in mapping fragments.
/// </summary>
private static IEnumerable<StorageTypeMapping> GetIsTypeOfMappingsForEntitySetAndType(
StorageMappingItemCollection mappingCollection, EntityContainer container, EntitySetBase entitySet, EntityTypeBase entityType,
EntityTypeBase childEntityType)
{
foreach (var mapping in GetMappingsForEntitySetAndType(mappingCollection, container, entitySet, entityType))
{
if (mapping.IsOfTypes.Any(parentType => parentType.IsAssignableFrom(childEntityType))
|| mapping.Types.Contains(childEntityType))
{
yield return mapping;
}
}
}
开发者ID:christiandpena,项目名称:entityframework,代码行数:16,代码来源:MappingMetadataHelper.cs
示例18: Can_remove_set_from_container
public void Can_remove_set_from_container()
{
var entityContainer = new EntityContainer("C", DataSpace.CSpace);
var associationSet = new AssociationSet("A", new AssociationType("A", XmlConstants.ModelNamespace_3, false, DataSpace.CSpace));
entityContainer.AddEntitySetBase(associationSet);
Assert.Equal(1, entityContainer.AssociationSets.Count);
entityContainer.RemoveEntitySetBase(associationSet);
Assert.Empty(entityContainer.AssociationSets);
Assert.Null(associationSet.EntityContainer);
}
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:14,代码来源:EntityContainerTests.cs
示例19: GetMappingsForEntitySetAndSuperTypes
/// <summary>
/// Returns all mapping fragments for the given entity set's types and their parent types.
/// </summary>
internal static IEnumerable<StorageTypeMapping> GetMappingsForEntitySetAndSuperTypes(
StorageMappingItemCollection mappingCollection, EntityContainer container, EntitySetBase entitySet,
EntityTypeBase childEntityType)
{
return MetadataHelper.GetTypeAndParentTypesOf(childEntityType, true /*includeAbstractTypes*/).SelectMany(
edmType =>
{
var entityTypeBase = edmType as EntityTypeBase;
return edmType.EdmEquals(childEntityType)
? GetMappingsForEntitySetAndType(mappingCollection, container, entitySet, entityTypeBase)
: GetIsTypeOfMappingsForEntitySetAndType(
mappingCollection, container, entitySet, entityTypeBase, childEntityType);
}).ToList();
}
开发者ID:christiandpena,项目名称:entityframework,代码行数:17,代码来源:MappingMetadataHelper.cs
示例20: WriteEntitySetMappingElement_should_write_modification_function_mappings
public void WriteEntitySetMappingElement_should_write_modification_function_mappings()
{
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));
var storageModificationFunctionMapping
= new ModificationFunctionMapping(
entitySet,
entityType,
new EdmFunction("F", "N", DataSpace.SSpace, new EdmFunctionPayload()),
Enumerable.Empty<ModificationFunctionParameterBinding>(),
null,
null);
storageEntitySetMapping.AddModificationFunctionMapping(
new EntityTypeModificationFunctionMapping(
entityType,
storageModificationFunctionMapping,
storageModificationFunctionMapping,
storageModificationFunctionMapping));
fixture.Writer.WriteEntitySetMappingElement(storageEntitySetMapping);
Assert.Equal(
@"<EntitySetMapping Name=""ES"">
<EntityTypeMapping TypeName="".E"">
<ModificationFunctionMapping>
<InsertFunction FunctionName=""N.F"" />
<UpdateFunction FunctionName=""N.F"" />
<DeleteFunction FunctionName=""N.F"" />
</ModificationFunctionMapping>
</EntityTypeMapping>
</EntitySetMapping>",
fixture.ToString());
}
开发者ID:jesusico83,项目名称:Telerik,代码行数:45,代码来源:MslXmlSchemaWriterTests.cs
注:本文中的System.Data.Entity.Core.Metadata.Edm.EntityContainer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论