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

C# Edm.EdmType类代码示例

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

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



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

示例1: FacetDescription

        /// <summary>
        ///     The constructor for constructing a facet description object
        /// </summary>
        /// <param name="facetName"> The name of this facet </param>
        /// <param name="facetType"> The type of this facet </param>
        /// <param name="minValue"> The min value for this facet </param>
        /// <param name="maxValue"> The max value for this facet </param>
        /// <param name="defaultValue"> The default value for this facet </param>
        /// <exception cref="System.ArgumentNullException">Thrown if either facetName, facetType or applicableType arguments are null</exception>
        internal FacetDescription(
            string facetName,
            EdmType facetType,
            int? minValue,
            int? maxValue,
            object defaultValue)
        {
            Check.NotEmpty(facetName, "facetName");
            Check.NotNull(facetType, "facetType");

            if (minValue.HasValue
                || maxValue.HasValue)
            {
                Debug.Assert(IsNumericType(facetType), "Min and Max Values can only be specified for numeric facets");

                if (minValue.HasValue
                    && maxValue.HasValue)
                {
                    Debug.Assert(minValue != maxValue, "minValue should not be equal to maxValue");
                }
            }

            _facetName = facetName;
            _facetType = facetType;
            _minValue = minValue;
            _maxValue = maxValue;
            _defaultValue = defaultValue;
        }
开发者ID:christiandpena,项目名称:entityframework,代码行数:37,代码来源:FacetDescription.cs


示例2: CreateGeneratedView

        /// <summary>
        ///     Creates generated view object for the combination of the <paramref name="extent" /> and the <paramref name="type" />.
        ///     This constructor is used for regular cell-based view generation.
        /// </summary>
        internal static GeneratedView CreateGeneratedView(
            EntitySetBase extent,
            EdmType type,
            DbQueryCommandTree commandTree,
            string eSQL,
            StorageMappingItemCollection mappingItemCollection,
            ConfigViewGenerator config)
        {
            // If config.GenerateEsql is specified, eSQL must be non-null.
            // If config.GenerateEsql is false, commandTree is non-null except the case when loading pre-compiled eSQL views.
            Debug.Assert(!config.GenerateEsql || !String.IsNullOrEmpty(eSQL), "eSQL must be specified");

            DiscriminatorMap discriminatorMap = null;
            if (commandTree != null)
            {
                commandTree = ViewSimplifier.SimplifyView(extent, commandTree);

                // See if the view matches the "discriminated" pattern (allows simplification of generated store commands)
                if (extent.BuiltInTypeKind
                    == BuiltInTypeKind.EntitySet)
                {
                    if (DiscriminatorMap.TryCreateDiscriminatorMap((EntitySet)extent, commandTree.Query, out discriminatorMap))
                    {
                        Debug.Assert(discriminatorMap != null, "discriminatorMap == null after it has been created");
                    }
                }
            }

            return new GeneratedView(extent, type, commandTree, eSQL, discriminatorMap, mappingItemCollection, config);
        }
开发者ID:christiandpena,项目名称:entityframework,代码行数:34,代码来源:GeneratedView.cs


示例3: QueryRewriter

        internal QueryRewriter(EdmType generatedType, ViewgenContext context, ViewGenMode typesGenerationMode)
        {
            Debug.Assert(typesGenerationMode != ViewGenMode.GenerateAllViews);

            _typesGenerationMode = typesGenerationMode;
            _context = context;
            _generatedType = generatedType;
            _domainMap = context.MemberMaps.LeftDomainMap;
            _config = context.Config;
            _identifiers = context.CqlIdentifiers;
            _qp = new RewritingProcessor<Tile<FragmentQuery>>(new DefaultTileProcessor<FragmentQuery>(context.LeftFragmentQP));
            _extentPath = new MemberPath(context.Extent);
            _keyAttributes = new List<MemberPath>(MemberPath.GetKeyMembers(context.Extent, _domainMap));

            // populate _fragmentQueries and _views
            foreach (var leftCellWrapper in _context.AllWrappersForExtent)
            {
                var query = leftCellWrapper.FragmentQuery;
                Tile<FragmentQuery> tile = CreateTile(query);
                _fragmentQueries.Add(query);
                _views.Add(tile);
            }
            Debug.Assert(_views.Count > 0);

            AdjustMemberDomainsForUpdateViews();

            // must be done after adjusting domains
            _domainQuery = GetDomainQuery(FragmentQueries, generatedType);

            _usedViews = new HashSet<FragmentQuery>();
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:31,代码来源:QueryRewriter.cs


示例4: PrepareMapping

        protected override PrepareMappingRes PrepareMapping(string typeFullName, EdmType edmItem)
        {
            string tableName = GetTableName(typeFullName);

            // find existing parent storageEntitySet
            // thp derived types does not have storageEntitySet
            EntitySet storageEntitySet;
            EdmType baseEdmType = edmItem;
            while (!EntityContainer.TryGetEntitySetByName(tableName, false, out storageEntitySet))
            {
                if (baseEdmType.BaseType == null)
                {
                    break;
                }
                baseEdmType = baseEdmType.BaseType;
            }

            if (storageEntitySet == null)
            {
                return null;
            }

            var isRoot = baseEdmType == edmItem;
            if (!isRoot)
            {
                var parent = _entityMaps.Values.FirstOrDefault(x => x.EdmType == baseEdmType);
                // parent table has not been mapped yet
                if (parent == null)
                {
                    throw new ParentNotMappedYetException();
                }
            }

            return new PrepareMappingRes { TableName = tableName, StorageEntitySet = storageEntitySet, IsRoot = isRoot, BaseEdmType = baseEdmType };
        }
开发者ID:schneidenbach,项目名称:EntityFramework.Metadata,代码行数:35,代码来源:DbFirstMapper.cs


示例5: TryCreateType

        public virtual EdmType TryCreateType(Type type, EdmType cspaceType)
        {
            DebugCheck.NotNull(type);
            DebugCheck.NotNull(cspaceType);
            Debug.Assert(cspaceType is StructuralType || Helper.IsEnumType(cspaceType), "Structural or enum type expected");

            // if one of the types is an enum while the other is not there is no match
            if (Helper.IsEnumType(cspaceType)
                ^ type.IsEnum())
            {
                LogLoadMessage(
                    Strings.Validator_OSpace_Convention_SSpaceOSpaceTypeMismatch(cspaceType.FullName, cspaceType.FullName),
                    cspaceType);
                return null;
            }

            EdmType newOSpaceType;
            if (Helper.IsEnumType(cspaceType))
            {
                TryCreateEnumType(type, (EnumType)cspaceType, out newOSpaceType);
                return newOSpaceType;
            }

            Debug.Assert(cspaceType is StructuralType);
            TryCreateStructuralType(type, (StructuralType)cspaceType, out newOSpaceType);
            return newOSpaceType;
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:27,代码来源:OSpaceTypeFactory.cs


示例6: GetSoftDeleteColumnName

		public static string GetSoftDeleteColumnName(EdmType type)
		{
			MetadataProperty annotation = type.MetadataProperties
				.SingleOrDefault(p => p.Name.EndsWith("customannotation:SoftDeleteColumnName"));

			return (string) annotation?.Value;
		}
开发者ID:tiepkn,项目名称:EF.Interceptor,代码行数:7,代码来源:SoftDeleteAttibute.cs


示例7: LogError

            public override void LogError(string errorMessage, EdmType relatedType)
            {
                var message = _loader.SessionData.LoadMessageLogger
                                     .CreateErrorMessageWithTypeSpecificLoadLogs(errorMessage, relatedType);

                _loader.SessionData.EdmItemErrors.Add(new EdmItemError(message));
            }
开发者ID:christiandpena,项目名称:entityframework,代码行数:7,代码来源:ObjectItemConventionAssemblyLoader.cs


示例8: GetTenantColumnName

        public static string GetTenantColumnName(EdmType type)
        {
            MetadataProperty annotation =
                type.MetadataProperties.SingleOrDefault(
                    p => p.Name.EndsWith(string.Format("customannotation:{0}", TenantAnnotation)));

            return annotation == null ? null : (string)annotation.Value;
        }
开发者ID:JensKlambauer,项目名称:EfMultitenant,代码行数:8,代码来源:TenantAwareAttribute.cs


示例9: CreateGeneratedViewForFKAssociationSet

 /// <summary>
 ///     Creates generated view object for the combination of the <paramref name="extent" /> and the <paramref name="type" />.
 ///     This constructor is used for FK association sets only.
 /// </summary>
 internal static GeneratedView CreateGeneratedViewForFKAssociationSet(
     EntitySetBase extent,
     EdmType type,
     DbQueryCommandTree commandTree,
     StorageMappingItemCollection mappingItemCollection,
     ConfigViewGenerator config)
 {
     return new GeneratedView(extent, type, commandTree, null, null, mappingItemCollection, config);
 }
开发者ID:christiandpena,项目名称:entityframework,代码行数:13,代码来源:GeneratedView.cs


示例10: LogLoadMessage

        internal void LogLoadMessage(string message, EdmType relatedType)
        {
            if (_logLoadMessage != null)
            {
                _logLoadMessage(message);
            }

            LogMessagesWithTypeInfo(message, relatedType);
        }
开发者ID:junxy,项目名称:entityframework,代码行数:9,代码来源:LoadMessageLogger.cs


示例11: TryGetNamespace

 internal bool TryGetNamespace(EdmType item, out EdmNamespace itemNamespace)
 {
     if (item != null)
     {
         return itemToNamespaceMap.TryGetValue(item, out itemNamespace);
     }
     itemNamespace = null;
     return false;
 }
开发者ID:jwanagel,项目名称:jjwtest,代码行数:9,代码来源:EdmModelParentMap.cs


示例12: ParameterDescriptor

        public ParameterDescriptor(string name, EdmType edmType, bool isOutParam)
        {
            Debug.Assert(name != null, "name is null");
            Debug.Assert(edmType != null, "edmType is null");

            _name = name;
            _edmType = edmType;
            _isOutParam = isOutParam;
        }
开发者ID:MartinBG,项目名称:Gva,代码行数:9,代码来源:ParameterDescriptor.cs


示例13: Type

        /// <summary>
        /// Gets the type identifier for the specified type.
        /// </summary>
        /// <param name="edmType">The type.</param>
        /// <returns>The identifier.</returns>
        public string Type(EdmType edmType)
        {
            if (edmType == null)
            {
                throw new ArgumentNullException("edmType");
            }

            return Identifier(edmType.Name);
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:14,代码来源:CodeHelper.cs


示例14: GetRename

        /// <summary>
        /// A default mapping (property "Foo" maps by convention to column "Foo"), if allowed, has the lowest precedence.
        /// A mapping for a specific type (EntityType="Bar") takes precedence over a mapping for a hierarchy (EntityType="IsTypeOf(Bar)"))
        /// If there are two hierarchy mappings, the most specific mapping takes precedence. 
        /// For instance, given the types Base, Derived1 : Base, and Derived2 : Derived1, 
        /// w.r.t. Derived1 "IsTypeOf(Derived1)" takes precedence over "IsTypeOf(Base)" when you ask for the rename of Derived1
        /// </summary>
        /// <param name="lineInfo">Empty for default rename mapping.</param>
        internal string GetRename(EdmType type, out IXmlLineInfo lineInfo)
        {
            Contract.Requires(type != null);

            Debug.Assert(type is StructuralType, "we can only rename structural type");

            var rename = _renameCache.Evaluate(type as StructuralType);
            lineInfo = rename.LineInfo;
            return rename.ColumnName;
        }
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:18,代码来源:FunctionImportReturnTypeStructuralTypeColumnRenameMapping.ReturnTypeRenameMapping.cs


示例15: GetRename

        /// <summary>
        ///     A default mapping (property "Foo" maps by convention to column "Foo"), if allowed, has the lowest precedence.
        ///     A mapping for a specific type (EntityType="Bar") takes precedence over a mapping for a hierarchy (EntityType="IsTypeOf(Bar)"))
        ///     If there are two hierarchy mappings, the most specific mapping takes precedence.
        ///     For instance, given the types Base, Derived1 : Base, and Derived2 : Derived1,
        ///     w.r.t. Derived1 "IsTypeOf(Derived1)" takes precedence over "IsTypeOf(Base)" when you ask for the rename of Derived1
        /// </summary>
        /// <param name="lineInfo"> Empty for default rename mapping. </param>
        internal string GetRename(EdmType type, out IXmlLineInfo lineInfo)
        {
            DebugCheck.NotNull(type);

            Debug.Assert(type is StructuralType, "we can only rename structural type");

            var rename = _renameCache.Evaluate(type as StructuralType);
            lineInfo = rename.LineInfo;
            return rename.ColumnName;
        }
开发者ID:christiandpena,项目名称:entityframework,代码行数:18,代码来源:FunctionImportReturnTypeStructuralTypeColumnRenameMapping.ReturnTypeRenameMapping.cs


示例16: TryCreateStructuralType

        private bool TryCreateStructuralType(Type type, StructuralType cspaceType, out EdmType newOSpaceType)
        {
            DebugCheck.NotNull(type);
            DebugCheck.NotNull(cspaceType);

            var referenceResolutionListForCurrentType = new List<Action>();
            newOSpaceType = null;

            StructuralType ospaceType;
            if (Helper.IsEntityType(cspaceType))
            {
                ospaceType = new ClrEntityType(type, cspaceType.NamespaceName, cspaceType.Name);
            }
            else
            {
                Debug.Assert(Helper.IsComplexType(cspaceType), "Invalid type attribute encountered");
                ospaceType = new ClrComplexType(type, cspaceType.NamespaceName, cspaceType.Name);
            }

            if (cspaceType.BaseType != null)
            {
                if (TypesMatchByConvention(type.BaseType(), cspaceType.BaseType))
                {
                    TrackClosure(type.BaseType());
                    referenceResolutionListForCurrentType.Add(
                        () => ospaceType.BaseType = ResolveBaseType((StructuralType)cspaceType.BaseType, type));
                }
                else
                {
                    var message = Strings.Validator_OSpace_Convention_BaseTypeIncompatible(
                        type.BaseType().FullName, type.FullName, cspaceType.BaseType.FullName);
                    LogLoadMessage(message, cspaceType);
                    return false;
                }
            }

            // Load the properties for this type
            if (!TryCreateMembers(type, cspaceType, ospaceType, referenceResolutionListForCurrentType))
            {
                return false;
            }

            // Add this to the known type map so we won't try to load it again
            LoadedTypes.Add(type.FullName, ospaceType);

            // we only add the referenceResolution to the list unless we structrually matched this type
            foreach (var referenceResolution in referenceResolutionListForCurrentType)
            {
                ReferenceResolutions.Add(referenceResolution);
            }

            newOSpaceType = ospaceType;
            return true;
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:54,代码来源:OSpaceTypeFactory.cs


示例17: CreateProperty

        private static EdmProperty CreateProperty(string name, EdmType edmType)
        {
            DebugCheck.NotEmpty(name);
            DebugCheck.NotNull(edmType);

            var typeUsage = TypeUsage.Create(edmType, new FacetValues());

            var property = new EdmProperty(name, typeUsage);

            return property;
        }
开发者ID:christiandpena,项目名称:entityframework,代码行数:11,代码来源:EdmProperty.cs


示例18: GetSoftDeleteColumnName

        public static string GetSoftDeleteColumnName(EdmType type)
        {
            // TODO Find the soft delete annotation and get the property name
            //      Name of annotation will be something like:
            //      http://schemas.microsoft.com/ado/2013/11/edm/customannotation:SoftDeleteColumnName

            MetadataProperty annotation = type.MetadataProperties
                .Where(p => p.Name.EndsWith("customannotation:SoftDeleteColumnName"))
                .SingleOrDefault();

            return annotation == null ? null : (string)annotation.Value;
        }
开发者ID:kennethversaw,项目名称:SoftwareArchitectureMadeEasy,代码行数:12,代码来源:SoftDeleteAttribute.cs


示例19: TryGetLoadedType

        /// <summary>
        ///     Check to see if the type is already loaded - either in the typesInLoading, or ObjectItemCollection or
        ///     in the global cache
        /// </summary>
        /// <param name="clrType"> </param>
        /// <param name="edmType"> </param>
        /// <returns> </returns>
        private bool TryGetLoadedType(Type clrType, out EdmType edmType)
        {
            if (SessionData.TypesInLoading.TryGetValue(clrType.FullName, out edmType)
                ||
                TryGetCachedEdmType(clrType, out edmType))
            {
                // Check to make sure the CLR type we got is the same as the given one
                if (edmType.ClrType != clrType)
                {
                    SessionData.EdmItemErrors.Add(
                        new EdmItemError(
                            Strings.NewTypeConflictsWithExistingType(
                                clrType.AssemblyQualifiedName, edmType.ClrType.AssemblyQualifiedName)));
                    edmType = null;
                    return false;
                }
                return true;
            }

            // Let's check to see if this type is a ref type, a nullable type, or a collection type, these are the types that
            // we need to take special care of them
            if (clrType.IsGenericType)
            {
                var genericType = clrType.GetGenericTypeDefinition();

                // Try to resolve the element type into a type object
                EdmType elementType;
                if (!TryGetLoadedType(clrType.GetGenericArguments()[0], out elementType))
                {
                    return false;
                }

                if (typeof(IEnumerable).IsAssignableFrom(clrType))
                {
                    var entityType = elementType as EntityType;
                    if (entityType == null)
                    {
                        // return null and let the caller deal with the error handling
                        return false;
                    }
                    edmType = entityType.GetCollectionType();
                }
                else
                {
                    edmType = elementType;
                }

                return true;
            }

            edmType = null;
            return false;
        }
开发者ID:jwanagel,项目名称:jjwtest,代码行数:60,代码来源:ObjectItemAttributeAssemblyLoader.cs


示例20: GetQualifiedPrefix

        public string GetQualifiedPrefix(EdmType item)
        {
            Debug.Assert(ModelParentMap != null);

            string qualifiedPrefix = null;
            EdmNamespace parentNamespace;
            if (ModelParentMap.TryGetNamespace(item, out parentNamespace))
            {
                qualifiedPrefix = parentNamespace.Name;
            }

            return qualifiedPrefix;
        }
开发者ID:jwanagel,项目名称:jjwtest,代码行数:13,代码来源:EdmModelValidationContext.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Edm.EntityContainer类代码示例发布时间:2022-05-26
下一篇:
C# Edm.EdmProperty类代码示例发布时间: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