本文整理汇总了C#中System.Data.Metadata.Edm.EntitySet类的典型用法代码示例。如果您正苦于以下问题:C# EntitySet类的具体用法?C# EntitySet怎么用?C# EntitySet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EntitySet类属于System.Data.Metadata.Edm命名空间,在下文中一共展示了EntitySet类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: EFTableProvider
public EFTableProvider(EFDataModelProvider dataModel, EntitySet entitySet, EntityType entityType,
Type entityClrType, Type parentEntityClrType, Type rootEntityClrType, string name)
: base(dataModel) {
EntityType = entityClrType;
Name = name;
DataContextPropertyName = entitySet.Name;
ParentEntityType = parentEntityClrType;
RootEntityType = rootEntityClrType;
var genericMethod = DataModel.ContextType.GetMethod("CreateQuery");
CreateQueryMethod = genericMethod.MakeGenericMethod(EntityType);
CreateQueryString = CreateEntitySqlQueryString(entitySet);
var keyMembers = entityType.KeyMembers;
// columns (entity properties)
// note 1: keys are also available through es.ElementType.KeyMembers
// note 2: this includes "nav properties", kind of fancy, two-way relationship objects
var columns = new List<ColumnProvider>();
foreach (EdmMember m in entityType.Members) {
if (EFColumnProvider.IsSupportedEdmMemberType(m) && IsPublicProperty(entityClrType, m.Name)) {
EFColumnProvider entityMember = new EFColumnProvider(entityType, this, m, keyMembers.Contains(m));
columns.Add(entityMember);
}
}
_roColumns = new ReadOnlyCollection<ColumnProvider>(columns);
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:29,代码来源:EFTableProvider.cs
示例2: EdmTableProvider
public EdmTableProvider(EdmDataModelProvider dataModel, EntitySet entitySet, EntityType entityType, string name,
bool isReadonly, bool supportPagingAndSorting)
: base(dataModel)
{
_isReadonly = isReadonly;
SupportPaging = supportPagingAndSorting;
Name = name;
DataContextPropertyName = entitySet.Name;
EdmEntityType = entityType;
var keyMembers = entityType.KeyMembers;
// columns (entity properties)
// note 1: keys are also available through es.ElementType.KeyMembers
// note 2: this includes "nav properties", kind of fancy, two-way relationship objects
var columns = new List<ColumnProvider>();
foreach (EdmMember m in entityType.Members) {
if (EdmColumnProvider.IsSupportedEdmMemberType(m)) {
var entityMember = new EdmColumnProvider(entityType, this, m, keyMembers.Contains(m), supportPagingAndSorting);
columns.Add(entityMember);
}
}
_roColumns = new ReadOnlyCollection<ColumnProvider>(columns);
}
开发者ID:davidebbo-test,项目名称:DynamicDataWCFDataService,代码行数:25,代码来源:EdmTableProvider.cs
示例3: 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");
this.m_tableExtent = tableExtent;
this.m_typeMapping = typeMapping;
this.m_isSQueryDistinct = distinctFlag;
}
开发者ID:uQr,项目名称:referencesource,代码行数:12,代码来源:StorageMappingFragment.cs
示例4: ObjectStateEntry
// ObjectStateEntry will not be detached and creation will be handled from ObjectStateManager
internal ObjectStateEntry(ObjectStateManager cache, EntitySet entitySet, EntityState state)
{
Debug.Assert(cache != null, "cache cannot be null.");
_cache = cache;
_entitySet = entitySet;
_state = state;
}
开发者ID:uQr,项目名称:referencesource,代码行数:9,代码来源:ObjectStateEntry.cs
示例5: ObjectStateEntry
// ObjectStateEntry will not be detached and creation will be handled from ObjectStateManager
internal ObjectStateEntry(ObjectStateManager cache, EntitySet entitySet, EntityState state)
{
//Contract.Requires(cache != null);
_cache = cache;
_entitySet = entitySet;
_state = state;
}
开发者ID:jimmy00784,项目名称:entityframework,代码行数:9,代码来源:ObjectStateEntry.cs
示例6: EntityRecordInfo
public EntityRecordInfo(EntityType metadata, IEnumerable<EdmMember> memberInfo, EntityKey entityKey, EntitySet entitySet)
: base(TypeUsage.Create(metadata), memberInfo)
{
//Contract.Requires(entityKey != null);
//Contract.Requires(entitySet != null);
_entityKey = entityKey;
ValidateEntityType(entitySet);
}
开发者ID:jimmy00784,项目名称:entityframework,代码行数:9,代码来源:EntityRecordInfo.cs
示例7: NewEntityBaseOp
private readonly List<RelProperty> m_relProperties; // list of relationship properties for which we have values
#endregion
#region constructors
internal NewEntityBaseOp(OpType opType, TypeUsage type, bool scoped, EntitySet entitySet, List<RelProperty> relProperties)
: base(opType, type)
{
Debug.Assert(scoped || entitySet == null, "entitySet cann't be set of constructor isn't scoped");
Debug.Assert(relProperties != null, "expected non-null list of rel-properties");
m_scoped = scoped;
m_entitySet = entitySet;
m_relProperties = relProperties;
}
开发者ID:jimmy00784,项目名称:entityframework,代码行数:15,代码来源:NewEntityBaseOp.cs
示例8: TableChangeProcessor
/// <summary>
/// Constructs processor based on the contents of a change node.
/// </summary>
/// <param name="table">Table for which changes are being processed.</param>
internal TableChangeProcessor(EntitySet table)
{
EntityUtil.CheckArgumentNull(table, "table");
m_table = table;
// cache information about table key
m_keyOrdinals = InitializeKeyOrdinals(table);
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:13,代码来源:TableChangeProcessor.cs
示例9: EntityRecordInfo
/// <summary>
///
/// </summary>
/// <param name="metadata"></param>
/// <param name="memberInfo"></param>
/// <param name="entityKey"></param>
public EntityRecordInfo(EntityType metadata, IEnumerable<EdmMember> memberInfo, EntityKey entityKey, EntitySet entitySet)
: base(TypeUsage.Create(metadata), memberInfo) {
EntityUtil.CheckArgumentNull<EntityKey>(entityKey, "entityKey");
EntityUtil.CheckArgumentNull(entitySet, "entitySet");
_entityKey = entityKey;
_entitySet = entitySet;
ValidateEntityType(entitySet);
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:15,代码来源:EntityRecordInfo.cs
示例10: TableChangeProcessor
/// <summary>
/// Constructs processor based on the contents of a change node.
/// </summary>
/// <param name="table">Table for which changes are being processed.</param>
internal TableChangeProcessor(EntitySet table)
{
//Contract.Requires(table != null);
m_table = table;
// cache information about table key
m_keyOrdinals = InitializeKeyOrdinals(table);
}
开发者ID:jimmy00784,项目名称:entityframework,代码行数:13,代码来源:TableChangeProcessor.cs
示例11: DiscriminatedEntityIdentity
private readonly EntitySet[] m_entitySetMap; // optional dictionary that maps values to entitysets
/// <summary>
/// Simple constructor
/// </summary>
/// <param name="entitySetColumn">column map representing the entityset</param>
/// <param name="entitySetMap">Map from value -> the appropriate entityset</param>
/// <param name="keyColumns">list of key columns</param>
internal DiscriminatedEntityIdentity(
SimpleColumnMap entitySetColumn, EntitySet[] entitySetMap,
SimpleColumnMap[] keyColumns)
: base(keyColumns)
{
Debug.Assert(entitySetColumn != null, "Must specify a column map to identify the entity set");
Debug.Assert(entitySetMap != null, "Must specify a dictionary to look up entitysets");
m_entitySetColumn = entitySetColumn;
m_entitySetMap = entitySetMap;
}
开发者ID:jimmy00784,项目名称:entityframework,代码行数:18,代码来源:DiscriminatedEntityIdentity.cs
示例12: DiscriminatorMap
private DiscriminatorMap(DbPropertyExpression discriminator,
List<KeyValuePair<object, EntityType>> typeMap,
Dictionary<EdmProperty, DbExpression> propertyMap,
Dictionary<Query.InternalTrees.RelProperty, DbExpression> relPropertyMap,
EntitySet entitySet)
{
this.Discriminator = discriminator;
this.TypeMap = typeMap.AsReadOnly();
this.PropertyMap = propertyMap.ToList().AsReadOnly();
this.RelPropertyMap = relPropertyMap.ToList().AsReadOnly();
this.EntitySet = entitySet;
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:12,代码来源:DiscriminatorMap.cs
示例13: GetAllStateEntries
/// <summary>
/// Finds all markup associated with the given source.
/// </summary>
/// <param name="source">Source expression. Must not be null.</param>
/// <param name="translator">Translator containing session information.</param>
/// <param name="sourceTable">Table from which the exception was thrown (must not be null).</param>
/// <returns>Markup.</returns>
internal static ReadOnlyCollection<IEntityStateEntry> GetAllStateEntries(PropagatorResult source, UpdateTranslator translator,
EntitySet sourceTable)
{
Debug.Assert(null != source);
Debug.Assert(null != translator);
Debug.Assert(null != sourceTable);
SourceInterpreter interpreter = new SourceInterpreter(translator, sourceTable);
interpreter.RetrieveResultMarkup(source);
return new ReadOnlyCollection<IEntityStateEntry>(interpreter.m_stateEntries);
}
开发者ID:uQr,项目名称:referencesource,代码行数:19,代码来源:SourceInterpreter.cs
示例14: DiscriminatorMap
private DiscriminatorMap(
DbPropertyExpression discriminator,
List<KeyValuePair<object, EntityType>> typeMap,
Dictionary<EdmProperty, DbExpression> propertyMap,
Dictionary<RelProperty, DbExpression> relPropertyMap,
EntitySet entitySet)
{
Discriminator = discriminator;
TypeMap = typeMap.AsReadOnly();
PropertyMap = propertyMap.ToList().AsReadOnly();
RelPropertyMap = relPropertyMap.ToList().AsReadOnly();
EntitySet = entitySet;
}
开发者ID:jimmy00784,项目名称:entityframework,代码行数:13,代码来源:DiscriminatorMap.cs
示例15: CreateFunctionImportStructuralTypeColumnMap
/// <summary>
/// Creates a column map for the given reader and function mapping.
/// </summary>
internal static CollectionColumnMap CreateFunctionImportStructuralTypeColumnMap(
DbDataReader storeDataReader, FunctionImportMappingNonComposable mapping, int resultSetIndex, EntitySet entitySet,
StructuralType baseStructuralType)
{
var resultMapping = mapping.GetResultMapping(resultSetIndex);
Debug.Assert(resultMapping != null);
if (resultMapping.NormalizedEntityTypeMappings.Count == 0) // no explicit mapping; use default non-polymorphic reader
{
// if there is no mapping, create default mapping to root entity type or complex type
Debug.Assert(!baseStructuralType.Abstract, "mapping loader must verify abstract types have explicit mapping");
return CreateColumnMapFromReaderAndType(
storeDataReader, baseStructuralType, entitySet, resultMapping.ReturnTypeColumnsRenameMapping);
}
// the section below deals with the polymorphic entity type mapping for return type
var baseEntityType = baseStructuralType as EntityType;
Debug.Assert(null != baseEntityType, "We should have entity type here");
// Generate column maps for all discriminators
var discriminatorColumns = CreateDiscriminatorColumnMaps(storeDataReader, mapping, resultSetIndex);
// Generate default maps for all mapped entity types
var mappedEntityTypes = new HashSet<EntityType>(resultMapping.MappedEntityTypes);
mappedEntityTypes.Add(baseEntityType); // make sure the base type is represented
var typeChoices = new Dictionary<EntityType, TypedColumnMap>(mappedEntityTypes.Count);
ColumnMap[] baseTypeColumnMaps = null;
foreach (var entityType in mappedEntityTypes)
{
var propertyColumnMaps = GetColumnMapsForType(storeDataReader, entityType, resultMapping.ReturnTypeColumnsRenameMapping);
var entityColumnMap = CreateEntityTypeElementColumnMap(
storeDataReader, entityType, entitySet, propertyColumnMaps, resultMapping.ReturnTypeColumnsRenameMapping);
if (!entityType.Abstract)
{
typeChoices.Add(entityType, entityColumnMap);
}
if (entityType == baseStructuralType)
{
baseTypeColumnMaps = propertyColumnMaps;
}
}
// NOTE: We don't have a null sentinel here, because the stored proc won't
// return one anyway; we'll just presume the data's always there.
var polymorphicMap = new MultipleDiscriminatorPolymorphicColumnMap(
TypeUsage.Create(baseStructuralType), baseStructuralType.Name, baseTypeColumnMaps, discriminatorColumns, typeChoices,
(object[] discriminatorValues) => mapping.Discriminate(discriminatorValues, resultSetIndex));
CollectionColumnMap collection = new SimpleCollectionColumnMap(
baseStructuralType.GetCollectionType().TypeUsage, baseStructuralType.Name, polymorphicMap, null, null);
return collection;
}
开发者ID:jimmy00784,项目名称:entityframework,代码行数:54,代码来源:columnmapfactory.cs
示例16: InitializeKeyOrdinals
// Determines which column ordinals in the table are part of the key.
private static int[] InitializeKeyOrdinals(EntitySet table)
{
EntityType tableType = table.ElementType;
IList<EdmMember> keyMembers = tableType.KeyMembers;
IBaseList<EdmMember> members = TypeHelpers.GetAllStructuralMembers(tableType);
int[] keyOrdinals = new int[keyMembers.Count];
for (int keyMemberIndex = 0; keyMemberIndex < keyMembers.Count; keyMemberIndex++)
{
EdmMember keyMember = keyMembers[keyMemberIndex];
keyOrdinals[keyMemberIndex] = members.IndexOf(keyMember);
Debug.Assert(keyOrdinals[keyMemberIndex] >= 0 && keyOrdinals[keyMemberIndex] < members.Count,
"an EntityType key member must also be a member of the entity type");
}
return keyOrdinals;
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:19,代码来源:TableChangeProcessor.cs
示例17: GetTableCreateScript
public string GetTableCreateScript(EntitySet entitySet, string connectionString, string version)
{
MySqlProviderServices service = new MySqlProviderServices();
if (!String.IsNullOrEmpty(version))
service.serverVersion = new Version(version);
else
{
using (var conn = new MySqlConnection(connectionString.Replace(@"""", "")))
{
conn.Open();
var v = DBVersion.Parse(conn.ServerVersion.ToString());
service.serverVersion = new Version(v.Major + "." + v.Minor);
}
}
if (service.serverVersion == null) service.serverVersion = new Version("5.5");
return service.GetTableCreateScript(entitySet);
}
开发者ID:luguandao,项目名称:MySql.Data,代码行数:18,代码来源:ProviderServices.cs
示例18: EntityDataSourceWrapperCollection
internal EntityDataSourceWrapperCollection(ObjectContext context, EntitySet entitySet, EntityType restrictedEntityType)
{
EntityDataSourceUtil.CheckArgumentNull(context, "context");
EntityDataSourceUtil.CheckArgumentNull(entitySet, "entitySet");
_context = context;
_wrapperList = new List<EntityDataSourceWrapper>();
// get handles on the relevant workspaces
MetadataWorkspace csWorkspace = ((EntityConnection)context.Connection).GetMetadataWorkspace();
MetadataWorkspace ocWorkspace = context.MetadataWorkspace;
// if no restricted type is given, we assume the entity set element type is exposed
EntityType entityType = restrictedEntityType ?? entitySet.ElementType;
_clrEntityType = EntityDataSourceUtil.GetClrType(ocWorkspace, entityType);
// if no restricted type is given and the set is polymorphic, make the collection readonly
if (null == restrictedEntityType &&
1 < EntityDataSourceUtil.GetTypeAndSubtypesOf(entityType, csWorkspace.GetItemCollection(DataSpace.CSpace), true).Count())
{
_isReadOnly = true;
}
// gather the properties
ReadOnlyCollection<EntityDataSourceColumn> columns = EntityDataSourceUtil.GetNamedColumns(csWorkspace, ocWorkspace, entitySet, entityType);
List<PropertyDescriptor> visiblePropertyDescriptors = new List<PropertyDescriptor>(columns.Count);
List<EntityDataSourceWrapperPropertyDescriptor> propertyDescriptors = new List<EntityDataSourceWrapperPropertyDescriptor>(columns.Count);
foreach (EntityDataSourceColumn column in columns)
{
var descriptor = new EntityDataSourceWrapperPropertyDescriptor(this, column);
propertyDescriptors.Add(descriptor);
// if the descriptor does not have a dependent, it is exposed to the user
if (!descriptor.Column.IsHidden)
{
visiblePropertyDescriptors.Add(descriptor);
}
}
_visiblePropertyDescriptors = new PropertyDescriptorCollection(visiblePropertyDescriptors.ToArray(), true);
AllPropertyDescriptors = propertyDescriptors.AsReadOnly();
}
开发者ID:uQr,项目名称:referencesource,代码行数:42,代码来源:EntityDataSourceWrapperCollection.cs
示例19: ForeignConstraint
// effects: Creates a foreign key constraint of the form:
// <i_childTable, i_childColumns> --> <i_parentTable, i_childColumns>
// i_fkeySet is the name of the constraint
internal ForeignConstraint(AssociationSet i_fkeySet, EntitySet i_parentTable, EntitySet i_childTable,
ReadOnlyMetadataCollection<EdmProperty> i_parentColumns, ReadOnlyMetadataCollection<EdmProperty> i_childColumns)
{
m_fKeySet = i_fkeySet;
m_parentTable = i_parentTable;
m_childTable = i_childTable;
m_childColumns = new List<MemberPath>();
// Create parent and child paths using the table names
foreach (EdmProperty property in i_childColumns)
{
MemberPath path = new MemberPath(m_childTable, property);
m_childColumns.Add(path);
}
m_parentColumns = new List<MemberPath>();
foreach (EdmProperty property in i_parentColumns)
{
MemberPath path = new MemberPath(m_parentTable, property);
m_parentColumns.Add(path);
}
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:24,代码来源:ForeignConstraint.cs
示例20: GetReferencedAssociationSetEnds
// requires: entitySet must not be null
// Yields all referenced association set ends in this mapping.
private static IEnumerable<AssociationSetEnd> GetReferencedAssociationSetEnds(
EntitySet entitySet, EntityType entityType, IEnumerable<StorageModificationFunctionParameterBinding> parameterBindings)
{
var ends = new HashSet<AssociationSetEnd>();
if (null != entitySet
&& null != entityType)
{
foreach (var parameterBinding in parameterBindings)
{
var end = parameterBinding.MemberPath.AssociationSetEnd;
if (null != end)
{
ends.Add(end);
}
}
// If there is a referential constraint, it counts as an implicit mapping of
// the association set
foreach (var assocationSet in MetadataHelper.GetAssociationsForEntitySet(entitySet))
{
var constraints = assocationSet.ElementType.ReferentialConstraints;
if (null != constraints)
{
foreach (var constraint in constraints)
{
if ((assocationSet.AssociationSetEnds[constraint.ToRole.Name].EntitySet == entitySet)
&&
(constraint.ToRole.GetEntityType().IsAssignableFrom(entityType)))
{
ends.Add(assocationSet.AssociationSetEnds[constraint.FromRole.Name]);
}
}
}
}
}
return ends;
}
开发者ID:jimmy00784,项目名称:entityframework,代码行数:39,代码来源:StorageModificationFunctionMapping.cs
注:本文中的System.Data.Metadata.Edm.EntitySet类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论