本文整理汇总了C#中System.Data.Entity.Core.Metadata.Edm.EntitySet类的典型用法代码示例。如果您正苦于以下问题:C# EntitySet类的具体用法?C# EntitySet怎么用?C# EntitySet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EntitySet类属于System.Data.Entity.Core.Metadata.Edm命名空间,在下文中一共展示了EntitySet类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Cannot_create_with_null_argument
public void Cannot_create_with_null_argument()
{
var entityType = new EntityType("ET", "N", DataSpace.CSpace);
var entitySet = new EntitySet("ES", "S", "T", "Q", entityType);
var function = new EdmFunction("F", "N", DataSpace.SSpace, new EdmFunctionPayload());
var parameterBindings = Enumerable.Empty<ModificationFunctionParameterBinding>();
var rowsAffectedParameter = new FunctionParameter("rows_affected", new TypeUsage(), ParameterMode.Out);
var resultBindings = Enumerable.Empty<ModificationFunctionResultBinding>();
Assert.Equal(
"entitySet",
Assert.Throws<ArgumentNullException>(
() => new ModificationFunctionMapping(
null, entityType, function,
parameterBindings, rowsAffectedParameter, resultBindings)).ParamName);
Assert.Equal(
"function",
Assert.Throws<ArgumentNullException>(
() => new ModificationFunctionMapping(
entitySet, entityType, null,
parameterBindings, rowsAffectedParameter, resultBindings)).ParamName);
Assert.Equal(
"parameterBindings",
Assert.Throws<ArgumentNullException>(
() => new ModificationFunctionMapping(
entitySet, entityType, function,
null, rowsAffectedParameter, resultBindings)).ParamName);
}
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:30,代码来源:ModificationFunctionMappingTests.cs
示例2: 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
示例3: AddEntityTypeMappingFragment
public void AddEntityTypeMappingFragment(
EntitySet entitySet, EntityType entityType, MappingFragment fragment)
{
Debug.Assert(fragment.Table == Table);
_entityTypes.Add(entitySet, entityType);
var defaultDiscriminatorColumn = fragment.GetDefaultDiscriminator();
foreach (var cm in fragment.ColumnMappings)
{
var columnMapping = FindOrCreateColumnMapping(cm.ColumnProperty);
columnMapping.AddMapping(
entityType,
cm.PropertyPath,
fragment.ColumnConditions.Where(cc => cc.Column == cm.ColumnProperty),
defaultDiscriminatorColumn == cm.ColumnProperty);
}
// Add any column conditions that aren't mapped to properties
foreach (
var cc in
fragment.ColumnConditions.Where(cc => fragment.ColumnMappings.All(pm => pm.ColumnProperty != cc.Column)))
{
var columnMapping = FindOrCreateColumnMapping(cc.Column);
columnMapping.AddMapping(entityType, null, new[] { cc }, defaultDiscriminatorColumn == cc.Column);
}
}
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:28,代码来源:TableMapping.cs
示例4: Cannot_create_function_if_entity_sets_not_null_an_not_matching_number_of_return_parameters
public void Cannot_create_function_if_entity_sets_not_null_an_not_matching_number_of_return_parameters()
{
var entitySet = new EntitySet("set", null, null, null, new EntityType("entity", "ns", DataSpace.CSpace));
Assert.Equal(
Resources.Strings.NumberOfEntitySetsDoesNotMatchNumberOfReturnParameters,
Assert.Throws<ArgumentException>(
() => new EdmFunction(
"foo",
"bar",
DataSpace.CSpace,
new EdmFunctionPayload()
{
EntitySets = new[] { entitySet, entitySet },
ReturnParameters =
new[]
{
new FunctionParameter(
"param",
TypeUsage.CreateDefaultTypeUsage(
PrimitiveType.GetEdmPrimitiveType(PrimitiveTypeKind.Int32)),
ParameterMode.ReturnValue)
,
}
})).Message);
}
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:26,代码来源:EdmFunctionTests.cs
示例5: AddEntityTypeMappingFragment
public void AddEntityTypeMappingFragment(
EntitySet entitySet, EntityType entityType, StorageMappingFragment fragment)
{
Debug.Assert(fragment.Table == Table);
_entityTypes.Add(entitySet, entityType);
var defaultDiscriminatorColumn = fragment.GetDefaultDiscriminator();
StorageConditionPropertyMapping defaultDiscriminatorCondition = null;
if (defaultDiscriminatorColumn != null)
{
defaultDiscriminatorCondition =
fragment.ColumnConditions.SingleOrDefault(cc => cc.ColumnProperty == defaultDiscriminatorColumn);
}
foreach (var pm in fragment.ColumnMappings)
{
var columnMapping = FindOrCreateColumnMapping(pm.ColumnProperty);
columnMapping.AddMapping(
entityType,
pm.PropertyPath,
fragment.ColumnConditions.Where(cc => cc.ColumnProperty == pm.ColumnProperty),
defaultDiscriminatorColumn == pm.ColumnProperty);
}
// Add any column conditions that aren't mapped to properties
foreach (
var cc in
fragment.ColumnConditions.Where(cc => !fragment.ColumnMappings.Any(pm => pm.ColumnProperty == cc.ColumnProperty)))
{
var columnMapping = FindOrCreateColumnMapping(cc.ColumnProperty);
columnMapping.AddMapping(entityType, null, new[] { cc }, defaultDiscriminatorColumn == cc.ColumnProperty);
}
}
开发者ID:jwanagel,项目名称:jjwtest,代码行数:34,代码来源:TableMapping.cs
示例6: CloneWithDefiningQuery
// internal for testing
internal static EntitySet CloneWithDefiningQuery(EntitySet sourceEntitySet, string definingQuery)
{
Debug.Assert(sourceEntitySet != null, "sourceEntitySet != null");
Debug.Assert(!string.IsNullOrWhiteSpace(definingQuery), "invalid definingQuery");
var metadataProperties =
sourceEntitySet.MetadataProperties.Where(p => p.PropertyKind != PropertyKind.System).ToList();
// these properties make it possible for the designer to track
// back these types to their source db objects
if (sourceEntitySet.Schema != null)
{
metadataProperties.Add(
StoreModelBuilder.CreateStoreModelBuilderMetadataProperty(
SchemaAttributeName,
sourceEntitySet.Schema));
}
if (sourceEntitySet.Table != null)
{
metadataProperties.Add(
StoreModelBuilder.CreateStoreModelBuilderMetadataProperty(
NameAttributeName,
sourceEntitySet.Table));
}
return
EntitySet.Create(
sourceEntitySet.Name,
null,
null,
definingQuery,
sourceEntitySet.ElementType,
metadataProperties);
}
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:36,代码来源:EntitySetDefiningQueryConverter.cs
示例7: Can_get_and_set_ends_via_wrapper_properties
public void Can_get_and_set_ends_via_wrapper_properties()
{
var associationType
= new AssociationType("A", XmlConstants.ModelNamespace_3, false, DataSpace.CSpace)
{
SourceEnd = new AssociationEndMember("S", new EntityType("E", "N", DataSpace.CSpace)),
TargetEnd = new AssociationEndMember("T", new EntityType("E", "N", DataSpace.CSpace))
};
var associationSet = new AssociationSet("A", associationType);
Assert.Null(associationSet.SourceSet);
Assert.Null(associationSet.TargetSet);
var sourceEntitySet = new EntitySet();
associationSet.SourceSet = sourceEntitySet;
var targetEntitySet = new EntitySet();
associationSet.TargetSet = targetEntitySet;
Assert.Same(sourceEntitySet, associationSet.SourceSet);
Assert.Same(targetEntitySet, associationSet.TargetSet);
}
开发者ID:christiandpena,项目名称:entityframework,代码行数:25,代码来源:AssociationSetTests.cs
示例8: GetTableName
/// <summary>
/// Helper method to get the table name for the given s-space <see cref="EntitySet" />.
/// </summary>
/// <param name="modelTable">The s-space entity set for the table.</param>
/// <returns>The table name.</returns>
protected virtual string GetTableName(EntitySet modelTable)
{
return modelTable.MetadataProperties.Contains("Table")
&& modelTable.MetadataProperties["Table"].Value != null
? (string)modelTable.MetadataProperties["Table"].Value
: modelTable.Name;
}
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:12,代码来源:TableExistenceChecker.cs
示例9: 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
示例10: Can_retrieve_properties
public void Can_retrieve_properties()
{
var source = new EntityType("Source", "N", DataSpace.CSpace);
var target = new EntityType("Target", "N", DataSpace.CSpace);
var sourceEnd = new AssociationEndMember("SourceEnd", source);
var targetEnd = new AssociationEndMember("TargetEnd", target);
var associationType
= AssociationType.Create(
"AT",
"N",
true,
DataSpace.CSpace,
sourceEnd,
targetEnd,
null,
null);
var sourceSet = new EntitySet("SourceSet", "S", "T", "Q", source);
var targetSet = new EntitySet("TargetSet", "S", "T", "Q", target);
var associationSet
= AssociationSet.Create(
"AS",
associationType,
sourceSet,
targetSet,
null);
var members = new List<EdmMember> { null, targetEnd };
var memberPath = new ModificationFunctionMemberPath(members, associationSet);
Assert.Equal(members, memberPath.Members);
Assert.Equal(targetEnd.Name, memberPath.AssociationSetEnd.Name);
}
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:32,代码来源:MidificationFunctionMemberPathTests.cs
示例11: Configure_association_set_should_call_configure_function_configurations
public void Configure_association_set_should_call_configure_function_configurations()
{
var modificationFunctionsConfiguration = new ModificationFunctionsConfiguration();
var mockModificationFunctionConfiguration = new Mock<ModificationFunctionConfiguration>();
modificationFunctionsConfiguration.Insert(mockModificationFunctionConfiguration.Object);
modificationFunctionsConfiguration.Delete(mockModificationFunctionConfiguration.Object);
var entitySet = new EntitySet();
entitySet.ChangeEntityContainerWithoutCollectionFixup(new EntityContainer("C", DataSpace.CSpace));
var storageModificationFunctionMapping
= new StorageModificationFunctionMapping(
entitySet,
new EntityType("E", "N", DataSpace.CSpace),
new EdmFunction("F", "N", DataSpace.SSpace),
new StorageModificationFunctionParameterBinding[0],
null,
null);
modificationFunctionsConfiguration.Configure(
new StorageAssociationSetModificationFunctionMapping(
new AssociationSet("AS", new AssociationType("A", XmlConstants.ModelNamespace_3, false, DataSpace.CSpace)),
storageModificationFunctionMapping,
storageModificationFunctionMapping));
mockModificationFunctionConfiguration
.Verify(m => m.Configure(storageModificationFunctionMapping), Times.Exactly(2));
}
开发者ID:christiandpena,项目名称:entityframework,代码行数:30,代码来源:ModificationFunctionsConfigurationTests.cs
示例12: PrimaryParameterBindings_should_omit_original_value_parameters_when_update
public void PrimaryParameterBindings_should_omit_original_value_parameters_when_update()
{
var entitySet = new EntitySet();
entitySet.ChangeEntityContainerWithoutCollectionFixup(new EntityContainer("C", DataSpace.CSpace));
var storageModificationFunctionMapping
= new StorageModificationFunctionMapping(
entitySet,
new EntityType("E", "N", DataSpace.CSpace),
new EdmFunction("F", "N", DataSpace.SSpace),
new[]
{
new StorageModificationFunctionParameterBinding(
new FunctionParameter(),
new StorageModificationFunctionMemberPath(
new EdmMember[]
{
new EdmProperty("M")
},
null),
false)
},
null,
null);
var storageEntityTypeModificationFunctionMapping
= new StorageEntityTypeModificationFunctionMapping(
new EntityType("E", "N", DataSpace.CSpace),
storageModificationFunctionMapping,
storageModificationFunctionMapping,
storageModificationFunctionMapping);
Assert.Equal(2, storageEntityTypeModificationFunctionMapping.PrimaryParameterBindings.Count());
}
开发者ID:christiandpena,项目名称:entityframework,代码行数:34,代码来源:StorageEntityTypeModificationFunctionMappingTests.cs
示例13: Can_not_create_composable_function_import_mapping_with_entity_set_and_null_structural_type_mappings
public void Can_not_create_composable_function_import_mapping_with_entity_set_and_null_structural_type_mappings()
{
var entityType = new EntityType("E", "N", DataSpace.CSpace);
var entitySet = new EntitySet("ES", null, null, null, entityType);
var functionImport =
new EdmFunction(
"f",
"entityModel",
DataSpace.CSpace,
new EdmFunctionPayload
{
IsComposable = true,
EntitySets = new[] { entitySet },
ReturnParameters =
new[]
{
new FunctionParameter(
"ReturnType",
TypeUsage.CreateDefaultTypeUsage(entityType),
ParameterMode.ReturnValue)
}
});
Assert.Equal(
Strings.ComposableFunctionImportsReturningEntitiesNotSupported,
Assert.Throws<NotSupportedException>(
() => new FunctionImportMappingComposable(
functionImport,
new EdmFunction(
"f", "store", DataSpace.CSpace, new EdmFunctionPayload { IsComposable = true }),
null)).Message);
}
开发者ID:christiandpena,项目名称:entityframework,代码行数:33,代码来源:FunctionImportMappingComposableTests.cs
示例14: Add
public void Add(EntitySet entitySet, EntityType entityType)
{
DebugCheck.NotNull(entitySet);
DebugCheck.NotNull(entityType);
var i = 0;
List<EntityType> entityTypes;
if (!_entityTypes.TryGetValue(entitySet, out entityTypes))
{
entityTypes = new List<EntityType>();
_entityTypes.Add(entitySet, entityTypes);
}
for (; i < entityTypes.Count; i++)
{
if (entityTypes[i] == entityType)
{
return;
}
else if (entityType.IsAncestorOf(entityTypes[i]))
{
break;
}
}
entityTypes.Insert(i, entityType);
}
开发者ID:christiandpena,项目名称:entityframework,代码行数:27,代码来源:SortedEntityTypeIndex.cs
示例15: Can_get_entity_set
public void Can_get_entity_set()
{
var entityContainerMapping = new StorageEntityContainerMapping(new EntityContainer("C", DataSpace.CSpace));
var entitySet = new EntitySet();
var entitySetMapping = new StorageEntitySetMapping(entitySet, entityContainerMapping);
Assert.Same(entitySet, entitySetMapping.EntitySet);
}
开发者ID:christiandpena,项目名称:entityframework,代码行数:8,代码来源:StorageEntitySetMappingTests.cs
示例16: ObjectStateEntry
// ObjectStateEntry will not be detached and creation will be handled from ObjectStateManager
internal ObjectStateEntry(ObjectStateManager cache, EntitySet entitySet, EntityState state)
{
DebugCheck.NotNull(cache);
_cache = cache;
_entitySet = entitySet;
_state = state;
}
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:9,代码来源:ObjectStateEntry.cs
示例17: Can_get_and_set_configuration_annotation
public void Can_get_and_set_configuration_annotation()
{
var entitySet = new EntitySet();
entitySet.SetConfiguration(42);
Assert.Equal(42, entitySet.GetConfiguration());
}
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:8,代码来源:EntitySetExtensionsTests.cs
示例18: StorageEntitySetMapping
/// <summary>
/// Construct a EntitySet mapping object
/// </summary>
/// <param name="extent"> EntitySet metadata object </param>
/// <param name="entityContainerMapping"> The entity Container Mapping that contains this Set mapping </param>
public StorageEntitySetMapping(EntitySet extent, StorageEntityContainerMapping entityContainerMapping)
: base(extent, entityContainerMapping)
{
Check.NotNull(extent, "extent");
m_modificationFunctionMappings = new List<StorageEntityTypeModificationFunctionMapping>();
m_implicitlyMappedAssociationSetEnds = new List<AssociationSetEnd>();
}
开发者ID:hallco978,项目名称:entityframework,代码行数:13,代码来源:StorageEntitySetMapping.cs
示例19: AppendDropTable
private void AppendDropTable(EntitySet entitySet)
{
AppendObjectExistenceCheck(GetQuotedTableNameWithSchema(entitySet), "U");
AppendSql(" drop table ");
AppendTableName(entitySet);
AppendSql(";");
AppendNewLine();
}
开发者ID:Kooboo,项目名称:Ecommerce,代码行数:8,代码来源:SqlScripts.cs
示例20: StorageMappingFragment
/// <summary>
/// Construct a new Mapping Fragment object
/// </summary>
/// <param name="tableExtent"></param>
/// <param name="typeMapping"></param>
internal StorageMappingFragment(EntitySet tableExtent, StorageTypeMapping typeMapping, bool distinctFlag)
{
Debug.Assert(tableExtent != null, "Table should not be null when constructing a Mapping Fragment");
Debug.Assert(typeMapping != null, "TypeMapping should not be null when constructing a Mapping Fragment");
m_tableExtent = tableExtent;
m_typeMapping = typeMapping;
m_isSQueryDistinct = distinctFlag;
}
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:13,代码来源:StorageMappingFragment.cs
注:本文中的System.Data.Entity.Core.Metadata.Edm.EntitySet类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论