当前位置: 首页>>代码示例>>C#>>正文


C# Edm.EdmType类代码示例

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


EdmType类属于System.Data.Metadata.Edm命名空间,在下文中一共展示了EdmType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
        {
            EntityUtil.CheckStringArgument(facetName, "facetName");
            EntityUtil.GenericCheckArgumentNull(facetType, "facetType");

            if (minValue.HasValue || maxValue.HasValue)
            {
                Debug.Assert(FacetDescription.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:iskiselev,项目名称:JSIL.NetFramework,代码行数:34,代码来源: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:JianwenSun,项目名称:cc,代码行数:32,代码来源: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:jimmy00784,项目名称:entityframework,代码行数:31,代码来源:QueryRewriter.cs

示例4: GetObjectMapping

        /// <summary>
        /// Retrieves a mapping to CLR type for the given EDM type. Assumes the MetadataWorkspace has no    
        /// </summary>
        internal static ObjectTypeMapping GetObjectMapping(EdmType type, MetadataWorkspace workspace)
        {
            // Check if the workspace has cspace item collection registered with it. If not, then its a case
            // of public materializer trying to create objects from PODR or EntityDataReader with no context.
            ItemCollection collection;
            if (workspace.TryGetItemCollection(DataSpace.CSpace, out collection))
            {
                return (ObjectTypeMapping)workspace.GetMap(type, DataSpace.OCSpace);
            }
            else
            {
                EdmType ospaceType;
                EdmType cspaceType;
                // If its a case of EntityDataReader with no context, the typeUsage which is passed in must contain
                // a cspace type. We need to look up an OSpace type in the ospace item collection and then create
                // ocMapping
                if (type.DataSpace == DataSpace.CSpace)
                {
                    // if its a primitive type, then the names will be different for CSpace type and OSpace type
                    if (Helper.IsPrimitiveType(type))
                    {
                        ospaceType = workspace.GetMappedPrimitiveType(((PrimitiveType)type).PrimitiveTypeKind, DataSpace.OSpace);
                    }
                    else
                    {
                        // Metadata will throw if there is no item with this identity present.
                        // Is this exception fine or does object materializer code wants to wrap and throw a new exception
                        ospaceType = workspace.GetItem<EdmType>(type.FullName, DataSpace.OSpace);
                    }
                    cspaceType = type;
                }
                else
                {
                    // In case of PODR, there is no cspace at all. We must create a fake ocmapping, with ospace types
                    // on both the ends
                    ospaceType = type;
                    cspaceType = type;
                }

                // This condition must be hit only when someone is trying to materialize a legacy data reader and we
                // don't have the CSpace metadata.
                if (!Helper.IsPrimitiveType(ospaceType) && !Helper.IsEntityType(ospaceType) && !Helper.IsComplexType(ospaceType))
                {
                    throw EntityUtil.MaterializerUnsupportedType();
                }

                ObjectTypeMapping typeMapping;

                if (Helper.IsPrimitiveType(ospaceType))
                {
                    typeMapping = new ObjectTypeMapping(ospaceType, cspaceType);
                }
                else
                {
                    typeMapping = DefaultObjectMappingItemCollection.LoadObjectMapping(cspaceType, ospaceType, null);
                }

                return typeMapping;
            }
        }
开发者ID:uQr,项目名称:referencesource,代码行数:63,代码来源:Util.cs

示例5: 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:JianwenSun,项目名称:cc,代码行数:12,代码来源:GeneratedView.cs

示例6: LogLoadMessage

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

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

示例7: 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:jimmy00784,项目名称:entityframework,代码行数:18,代码来源:FunctionImportReturnTypeStructuralTypeColumnRenameMapping.ReturnTypeRenameMapping.cs

示例8: TryGetEdmType

 internal bool TryGetEdmType(string typeName, out EdmType edmType)
 {
     edmType = null;
     foreach (EdmType loadedEdmType in this.TypesInAssembly)
     {
         if (loadedEdmType.Identity == typeName)
         {
             edmType = loadedEdmType;
             break;
         }
     }
     return (edmType != null);
 }
开发者ID:uQr,项目名称:referencesource,代码行数:13,代码来源:AssemblyCacheEntry.cs

示例9: LogMessagesWithTypeInfo

        private void LogMessagesWithTypeInfo(string message, EdmType relatedType)
        {
            Debug.Assert(relatedType != null, "have to have a type with this message");

            if (_messages.ContainsKey(relatedType))
            {
                // if this type already contains loading message, append the new message to the end
                _messages[relatedType].AppendLine(message);
            }
            else
            {
                _messages.Add(relatedType, new StringBuilder(message));
            }
        }
开发者ID:jimmy00784,项目名称:entityframework,代码行数:14,代码来源:LoadMessageLogger.cs

示例10: 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(System.Data.Entity.Strings.NewTypeConflictsWithExistingType(
                                                clrType.AssemblyQualifiedName, edmType.ClrType.AssemblyQualifiedName), edmType));
                    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)
            {
                Type 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(System.Collections.IEnumerable).IsAssignableFrom(clrType))
                {
                    EntityType 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:iskiselev,项目名称:JSIL.NetFramework,代码行数:57,代码来源:ObjectItemAttributeAssemblyLoader.cs

示例11: GetFacetDescriptions

        /// <summary>
        /// Returns all the FacetDescriptions for a particular type
        /// </summary>
        /// <param name="type">the type to return FacetDescriptions for.</param>
        /// <returns>The FacetDescriptions for the type given.</returns>
        public override ReadOnlyCollection<FacetDescription> GetFacetDescriptions(EdmType type)
        {
            Debug.Assert(type is PrimitiveType, "EdmProviderManifest.GetFacetDescriptions(): Argument is not a PrimitiveType");

            InitializeFacetDescriptions();

            // Some types may not have facets, so just try to get them, if there aren't any, just return an empty list
            ReadOnlyCollection<FacetDescription> collection = null;
            if (_facetDescriptions.TryGetValue(type as PrimitiveType, out collection))
            {
                return collection;
            }
            return Helper.EmptyFacetDescriptionEnumerable;
        }
开发者ID:jimmy00784,项目名称:entityframework,代码行数:19,代码来源:EdmProviderManifest.cs

示例12: ObjectTypeMapping

        /// <summary>
        /// Construct a new ObjectTypeMapping object
        /// </summary>
        /// <param name="clrType"></param>
        /// <param name="cdmType"></param>
        internal ObjectTypeMapping(EdmType clrType, EdmType cdmType) {
            Debug.Assert(clrType.BuiltInTypeKind == cdmType.BuiltInTypeKind, "BuiltInTypeKind must be the same for both types");
            this.m_clrType = clrType;
            this.m_cdmType = cdmType;
            identity = clrType.Identity + ObjectMslConstructs.IdentitySeperator + cdmType.Identity;

            if (Helper.IsStructuralType(cdmType))
            {
                m_memberMapping = new Dictionary<string, ObjectMemberMapping>(((StructuralType)cdmType).Members.Count);
            }
            else
            {
                m_memberMapping = EmptyMemberMapping;
            }
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:20,代码来源:ObjectTypeMapping.cs

示例13: GetTypeRelatedLogMessage

        private string GetTypeRelatedLogMessage(EdmType relatedType)
        {
            Debug.Assert(relatedType != null, "have to pass in a type to get the message");

            if (_messages.ContainsKey(relatedType))
            {
                return new StringBuilder()
                    .AppendLine()
                    .AppendLine(Strings.ExtraInfo)
                    .AppendLine(_messages[relatedType].ToString()).ToString();
            }
            else
            {
                return string.Empty;
            }
        }
开发者ID:jimmy00784,项目名称:entityframework,代码行数:16,代码来源:LoadMessageLogger.cs

示例14: MetadataProperty

        /// <summary>
        /// The constructor for MetadataProperty taking in all the ingredients for creating TypeUsage and the actual value
        /// </summary>
        /// <param name="name">The name of the attribute</param>
        /// <param name="edmType">The edm type of the attribute</param>
        /// <param name="isCollectionType">Whether the collection type of the given edm type should be used</param>
        /// <param name="value">The value of the attribute</param>
        internal MetadataProperty(string name, EdmType edmType, bool isCollectionType, object value)
        {
            EntityUtil.CheckArgumentNull(edmType, "edmType");

            _name = name;
            _value = value;
            if (isCollectionType)
            {
                _typeUsage = TypeUsage.Create(edmType.GetCollectionType());
            }
            else
            {
                _typeUsage = TypeUsage.Create(edmType);
            }
            _propertyKind = PropertyKind.System;
        }
开发者ID:uQr,项目名称:referencesource,代码行数:23,代码来源:MetadataProperty.cs

示例15: MetadataProperty

        /// <summary>
        /// The constructor for MetadataProperty taking in all the ingredients for creating TypeUsage and the actual value
        /// </summary>
        /// <param name="name">The name of the attribute</param>
        /// <param name="edmType">The edm type of the attribute</param>
        /// <param name="isCollectionType">Whether the collection type of the given edm type should be used</param>
        /// <param name="value">The value of the attribute</param>
        internal MetadataProperty(string name, EdmType edmType, bool isCollectionType, object value)
        {
            //Contract.Requires(edmType != null);

            _name = name;
            _value = value;
            if (isCollectionType)
            {
                _typeUsage = TypeUsage.Create(edmType.GetCollectionType());
            }
            else
            {
                _typeUsage = TypeUsage.Create(edmType);
            }
            _propertyKind = PropertyKind.System;
        }
开发者ID:jimmy00784,项目名称:entityframework,代码行数:23,代码来源:MetadataProperty.cs


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