本文整理汇总了C#中System.Data.Entity.Core.Metadata.Edm.EdmType类的典型用法代码示例。如果您正苦于以下问题:C# EdmType类的具体用法?C# EdmType怎么用?C# EdmType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EdmType类属于System.Data.Entity.Core.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)
{
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;
}
示例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);
}
示例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>();
}
示例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 };
}
示例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;
}
示例6: GetSoftDeleteColumnName
public static string GetSoftDeleteColumnName(EdmType type)
{
MetadataProperty annotation = type.MetadataProperties
.SingleOrDefault(p => p.Name.EndsWith("customannotation:SoftDeleteColumnName"));
return (string) annotation?.Value;
}
示例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));
}
示例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;
}
示例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);
}
示例10: LogLoadMessage
internal void LogLoadMessage(string message, EdmType relatedType)
{
if (_logLoadMessage != null)
{
_logLoadMessage(message);
}
LogMessagesWithTypeInfo(message, relatedType);
}
示例11: TryGetNamespace
internal bool TryGetNamespace(EdmType item, out EdmNamespace itemNamespace)
{
if (item != null)
{
return itemToNamespaceMap.TryGetValue(item, out itemNamespace);
}
itemNamespace = null;
return false;
}
示例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;
}
示例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);
}
示例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