• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Edm.EntityType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Data.Metadata.Edm.EntityType的典型用法代码示例。如果您正苦于以下问题:C# EntityType类的具体用法?C# EntityType怎么用?C# EntityType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



EntityType类属于System.Data.Metadata.Edm命名空间,在下文中一共展示了EntityType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: EdmColumnProvider

        public EdmColumnProvider(EntityType entityType, EdmTableProvider table, EdmMember m, bool isPrimaryKey, bool supportPagingAndSorting)
            : base(table)
        {
            EdmMember = m;
            IsPrimaryKey = isPrimaryKey;
            _table = table;
            _supportSorting = supportPagingAndSorting;
            MaxLength = 0;
            Name = EdmMember.Name;
            // REVIEW Seems like extra properties added in partial classes are not even detected by the metadata engine
            IsCustomProperty = false;

            // REVIEW: This should probably be a debug assert or we should only pass an EmdProperty
            var property = EdmMember as EdmProperty;

            if (property != null) {
                IsForeignKeyComponent = DetermineIsForeignKeyComponent(property);
                IsGenerated = IsServerGenerated(property);
            }

            ProcessFacets();

            var navProp = m as NavigationProperty;
            if (navProp != null) {
                _isAssociation = true;
                long key = EdmAssociationProvider.BuildRelationshipKey(entityType, navProp.FromEndMember);
                ((EdmDataModelProvider)table.DataModel).RelationshipEndLookup[key] = this;
            }
        }
开发者ID:davidebbo-test,项目名称:DynamicDataWCFDataService,代码行数:29,代码来源:EdmColumnProvider.cs


示例2: SerializableImplementor

        internal SerializableImplementor(EntityType ospaceEntityType)
        {
            _baseClrType = ospaceEntityType.ClrType;
            _baseImplementsISerializable = _baseClrType.IsSerializable && typeof(ISerializable).IsAssignableFrom(_baseClrType);

            if (_baseImplementsISerializable)
            {
                // Determine if interface implementation can be overridden.
                // Fortunately, there's only one method to check.
                var mapping = _baseClrType.GetInterfaceMap(typeof(ISerializable));
                _getObjectDataMethod = mapping.TargetMethods[0];

                // Members that implement interfaces must be public, unless they are explicitly implemented, in which case they are private and sealed (at least for C#).
                var canOverrideMethod = (_getObjectDataMethod.IsVirtual && !_getObjectDataMethod.IsFinal) && _getObjectDataMethod.IsPublic;

                if (canOverrideMethod)
                {
                    // Determine if proxied type provides the special serialization constructor.
                    // In order for the proxy class to properly support ISerializable, this constructor must not be private.
                    _serializationConstructor =
                        _baseClrType.GetConstructor(
                            BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null,
                            new[] { typeof(SerializationInfo), typeof(StreamingContext) }, null);

                    _canOverride = _serializationConstructor != null
                                   &&
                                   (_serializationConstructor.IsPublic || _serializationConstructor.IsFamily
                                    || _serializationConstructor.IsFamilyOrAssembly);
                }

                Debug.Assert(
                    !(_canOverride && (_getObjectDataMethod == null || _serializationConstructor == null)),
                    "Both GetObjectData method and Serialization Constructor must be present when proxy overrides ISerializable implementation.");
            }
        }
开发者ID:jimmy00784,项目名称:entityframework,代码行数:35,代码来源:SerializableImplementor.cs


示例3: TryGetEntityType

 public static bool TryGetEntityType(ObjectContext context, Type clrType, out EntityType entityType)
 {
     entityType = null;
     if (context == null)
     {
         throw new ArgumentNullException("context");
     }
     if (clrType == null)
     {
         throw new ArgumentNullException("clrType");
     }
     EdmType type = null;
     bool flag = context.MetadataWorkspace.TryGetType(clrType.Name, clrType.Namespace, DataSpace.OSpace, out type);
     if (!flag)
     {
         LoadAssemblyIntoWorkspace(context.MetadataWorkspace, clrType.Assembly);
         flag = context.MetadataWorkspace.TryGetType(clrType.Name, clrType.Namespace, DataSpace.OSpace, out type);
     }
     if (flag)
     {
         entityType = (EntityType)context.MetadataWorkspace.GetEdmSpaceType((StructuralType)type);
         return true;
     }
     return false;
 }
开发者ID:mbsky,项目名称:myextensions,代码行数:25,代码来源:EntityHelper.cs


示例4: 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


示例5: 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


示例6: CreateNodeFactoryForEntity

        private INodeFactory CreateNodeFactoryForEntity(EntityType entity)
        {
            var type = MetadataHelpers.FindQualifiedTypeForEntity(entity);

            var factory = CreateClosedGenericNodeFactory(type);
            return factory;
        }
开发者ID:modulexcite,项目名称:EntityShell,代码行数:7,代码来源:RootNodeFactory.cs


示例7: GetGenerationOption

        public string GetGenerationOption(EdmProperty property, EntityType entity)
        {
            string result = "";
            bool isPk = entity.KeyMembers.Contains(property);
            MetadataProperty storeGeneratedPatternProperty = null;
            string storeGeneratedPatternPropertyValue = "None";

            if (property.MetadataProperties.TryGetValue(MetadataConstants.EDM_ANNOTATION_09_02 + ":StoreGeneratedPattern", false, out storeGeneratedPatternProperty))
                storeGeneratedPatternPropertyValue = storeGeneratedPatternProperty.Value.ToString();

            PrimitiveType edmType = (PrimitiveType)property.TypeUsage.EdmType;
            if (edmType == null && property.TypeUsage.EdmType is EnumType)
            {
                EnumType enumType = property.TypeUsage.EdmType as EnumType;
                edmType = enumType.UnderlyingType;
            }
            if (storeGeneratedPatternPropertyValue == "Computed")
            {
                result = ".HasDatabaseGeneratedOption(new Nullable<DatabaseGeneratedOption>(DatabaseGeneratedOption.Computed))";
            }
            else if ((edmType.ClrEquivalentType == typeof(int)) || (edmType.ClrEquivalentType == typeof(short)) || (edmType.ClrEquivalentType == typeof(long)))
            {
                if (isPk && (storeGeneratedPatternPropertyValue != "Identity"))
                    result = ".HasDatabaseGeneratedOption(new Nullable<DatabaseGeneratedOption>(DatabaseGeneratedOption.None))";
                else if ((!isPk || (entity.KeyMembers.Count > 1)) && (storeGeneratedPatternPropertyValue == "Identity"))
                    result = ".HasDatabaseGeneratedOption(new Nullable<DatabaseGeneratedOption>(DatabaseGeneratedOption.Identity))";
            }
            return result;
        }
开发者ID:jradxl,项目名称:Entity-Framework-Code-Generation-Tools-Experiments,代码行数:29,代码来源:EF5DbContextFluentMappingLibrary.cs


示例8: RefType

 /// <summary>
 /// The constructor for constructing a RefType object with the entity type it references
 /// </summary>
 /// <param name="entityType">The entity type that this ref type references</param>
 /// <exception cref="System.ArgumentNullException">Thrown if entityType argument is null</exception>
 internal RefType(EntityType entityType)
     : base(GetIdentity(EntityUtil.GenericCheckArgumentNull(entityType, "entityType")), 
     EdmConstants.TransientNamespace, entityType.DataSpace)
 {
     _elementType = entityType;
     SetReadOnly();
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:12,代码来源:RefType.cs


示例9: EFColumnProvider

        public EFColumnProvider(EntityType entityType, EFTableProvider table, EdmMember m, bool isPrimaryKey)
            : base(table) {
            EdmMember = m;
            IsPrimaryKey = isPrimaryKey;
            _table = table;
            MaxLength = 0;
            Name = EdmMember.Name;
            // 
            IsCustomProperty = false;

            // 
            var property = EdmMember as EdmProperty;

            if (property != null) {
                IsForeignKeyComponent = DetermineIsForeignKeyComponent(property);
                IsGenerated = IsServerGenerated(property);
            }

            ProcessFacets();

            var navProp = m as NavigationProperty;
            if (navProp != null) {
                _isAssociation = true;
                long key = EFAssociationProvider.BuildRelationshipKey(entityType, navProp.FromEndMember);
                ((EFDataModelProvider)table.DataModel).RelationshipEndLookup[key] = this;
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:27,代码来源:EFColumnProvider.cs


示例10: AbstractOption

 /// <summary>
 /// Returns the abstract option if the entity is Abstract, otherwise returns String.Empty
 /// </summary>
 public string AbstractOption(EntityType entity)
 {
     if (entity.Abstract)
     {
         return "abstract";
     }
     return String.Empty;
 }
开发者ID:KCL5South,项目名称:KCLTextTemplating,代码行数:11,代码来源:CodeGenerationTools.cs


示例11: 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


示例12: 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


示例13: DataContractImplementor

        internal DataContractImplementor(EntityType ospaceEntityType)
        {
            _baseClrType = ospaceEntityType.ClrType;

            var attributes = (DataContractAttribute[])_baseClrType.GetCustomAttributes(typeof(DataContractAttribute), false);
            if (attributes.Length > 0)
            {
                _dataContract = attributes[0];
            }
        }
开发者ID:jimmy00784,项目名称:entityframework,代码行数:10,代码来源:DataContractImplementor.cs


示例14: GetKeysForEntityType

        // effects: Determines all the keys (unique and primary for
        // entityType) for entityType and returns a key. "prefix" gives the
        // path of the extent or end of a relationship in a relationship set
        // -- prefix is prepended to the entity's key fields to get the full memberpath
        internal static List<ExtentKey> GetKeysForEntityType(MemberPath prefix, EntityType entityType)
        {
            // CHANGE_ADYA_MULTIPLE_KEYS: currently there is a single key only. Need to support
            // keys inside complex types + unique keys
            var key = GetPrimaryKeyForEntityType(prefix, entityType);

            var keys = new List<ExtentKey>();
            keys.Add(key);
            return keys;
        }
开发者ID:jimmy00784,项目名称:entityframework,代码行数:14,代码来源:ExtentKey.cs


示例15: CheckType

        private void CheckType(EntityType ospaceEntityType)
        {
            _scalarMembers = new HashSet<EdmMember>();
            _relationshipMembers = new HashSet<EdmMember>();

            foreach (var member in ospaceEntityType.Members)
            {
                var clrProperty = EntityUtil.GetTopProperty(ospaceEntityType.ClrType, member.Name);
                if (clrProperty != null
                    && EntityProxyFactory.CanProxySetter(clrProperty))
                {
                    if (member.BuiltInTypeKind
                        == BuiltInTypeKind.EdmProperty)
                    {
                        if (_implementIEntityWithChangeTracker)
                        {
                            _scalarMembers.Add(member);
                        }
                    }
                    else if (member.BuiltInTypeKind
                             == BuiltInTypeKind.NavigationProperty)
                    {
                        if (_implementIEntityWithRelationships)
                        {
                            var navProperty = (NavigationProperty)member;
                            var multiplicity = navProperty.ToEndMember.RelationshipMultiplicity;

                            if (multiplicity == RelationshipMultiplicity.Many)
                            {
                                if (clrProperty.PropertyType.IsGenericType
                                    &&
                                    clrProperty.PropertyType.GetGenericTypeDefinition() == typeof(ICollection<>))
                                {
                                    _relationshipMembers.Add(member);
                                }
                            }
                            else
                            {
                                _relationshipMembers.Add(member);
                            }
                        }
                    }
                }
            }

            if (ospaceEntityType.Members.Count
                != _scalarMembers.Count + _relationshipMembers.Count)
            {
                _scalarMembers.Clear();
                _relationshipMembers.Clear();
                _implementIEntityWithChangeTracker = false;
                _implementIEntityWithRelationships = false;
            }
        }
开发者ID:jimmy00784,项目名称:entityframework,代码行数:54,代码来源:IPOCOImplementor.cs


示例16: StorageEntityTypeModificationFunctionMapping

 internal StorageEntityTypeModificationFunctionMapping(
     EntityType entityType,
     StorageModificationFunctionMapping deleteFunctionMapping,
     StorageModificationFunctionMapping insertFunctionMapping,
     StorageModificationFunctionMapping updateFunctionMapping)
 {
     this.EntityType = EntityUtil.CheckArgumentNull(entityType, "entityType");
     this.DeleteFunctionMapping = deleteFunctionMapping;
     this.InsertFunctionMapping = insertFunctionMapping;
     this.UpdateFunctionMapping = updateFunctionMapping;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:11,代码来源:StorageModificationFunctionMapping.cs


示例17: GetAssemblyNameFromEntity

        private static string GetAssemblyNameFromEntity(EntityType entity)
        {
            var name = entity.FullName;
            string assemblyName = null;

            if (!_assemblyNames.TryGetValue(name, out assemblyName))
            {
                assemblyName = LoadEntityTypeAssemblyName(entity);
                _assemblyNames[name] = assemblyName;
            }
            return assemblyName;
        }
开发者ID:modulexcite,项目名称:EntityShell,代码行数:12,代码来源:MetadataHelpers.cs


示例18: IPOCOImplementor

        public IPOCOImplementor(EntityType ospaceEntityType)
        {
            var baseType = ospaceEntityType.ClrType;
            _referenceProperties = new List<KeyValuePair<NavigationProperty, PropertyInfo>>();
            _collectionProperties = new List<KeyValuePair<NavigationProperty, PropertyInfo>>();

            _implementIEntityWithChangeTracker = (null == baseType.GetInterface(typeof(IEntityWithChangeTracker).Name));
            _implementIEntityWithRelationships = (null == baseType.GetInterface(typeof(IEntityWithRelationships).Name));

            CheckType(ospaceEntityType);

            _ospaceEntityType = ospaceEntityType;
        }
开发者ID:jimmy00784,项目名称:entityframework,代码行数:13,代码来源:IPOCOImplementor.cs


示例19: GetTypeId

 /// <summary>
 /// Returns the type id for the given entity type, or null if non exists.
 /// </summary>
 internal object GetTypeId(EntityType entityType)
 {
     object result = null;
     foreach (var discriminatorTypePair in this.TypeMap)
     {
         if (discriminatorTypePair.Value.EdmEquals(entityType))
         {
             result = discriminatorTypePair.Key;
             break;
         }
     }
     return result;
 }
开发者ID:uQr,项目名称:referencesource,代码行数:16,代码来源:ExplicitDiscriminatorMap.cs


示例20: StorageEntityTypeModificationFunctionMapping

        internal StorageEntityTypeModificationFunctionMapping(
            EntityType entityType,
            StorageModificationFunctionMapping deleteFunctionMapping,
            StorageModificationFunctionMapping insertFunctionMapping,
            StorageModificationFunctionMapping updateFunctionMapping)
        {
            //Contract.Requires(entityType != null);

            EntityType = entityType;
            DeleteFunctionMapping = deleteFunctionMapping;
            InsertFunctionMapping = insertFunctionMapping;
            UpdateFunctionMapping = updateFunctionMapping;
        }
开发者ID:jimmy00784,项目名称:entityframework,代码行数:13,代码来源:StorageEntityTypeModificationFunctionMapping.cs



注:本文中的System.Data.Metadata.Edm.EntityType类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Edm.StoreItemCollection类代码示例发布时间:2022-05-26
下一篇:
C# Edm.EntitySetBase类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap