本文整理汇总了C#中TypeUsage类的典型用法代码示例。如果您正苦于以下问题:C# TypeUsage类的具体用法?C# TypeUsage怎么用?C# TypeUsage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TypeUsage类属于命名空间,在下文中一共展示了TypeUsage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: TryGetType
/// <summary>
/// Given a clrType attempt to return the corresponding target type from
/// the worksapce
/// </summary>
/// <param name="clrType"> The clr type to resolve </param>
/// <param name="outTypeUsage"> an out param for the typeUsage to be resolved to </param>
/// <returns> true if a TypeUsage can be found for the target type </returns>
internal bool TryGetType(Type clrType, out TypeUsage outTypeUsage)
{
return TryGetTypeByName(
clrType.FullNameWithNesting(),
false /*ignoreCase*/,
out outTypeUsage);
}
开发者ID:christiandpena,项目名称:entityframework,代码行数:14,代码来源:ClrPerspective.cs
示例2: TryGetTypeByName
/// <summary>
/// Look up a type in the target data space based upon the fullName
/// </summary>
/// <param name="fullName"> fullName </param>
/// <param name="ignoreCase"> true for case-insensitive lookup </param>
/// <param name="typeUsage"> The type usage object to return </param>
/// <returns> True if the retrieval succeeded </returns>
internal override bool TryGetTypeByName(string fullName, bool ignoreCase, out TypeUsage typeUsage)
{
typeUsage = null;
Map map = null;
// From ClrPerspective, we should not allow anything from SSpace. So make sure that the CSpace type does not
// have the Target attribute
if (MetadataWorkspace.TryGetMap(fullName, DataSpace.OSpace, ignoreCase, DataSpace.OCSpace, out map))
{
// Check if it's primitive type, if so, then use the MetadataWorkspace to get the mapped primitive type
if (map.EdmItem.BuiltInTypeKind
== BuiltInTypeKind.PrimitiveType)
{
// Reassign the variable with the provider primitive type, then create the type usage
var primitiveType = MetadataWorkspace.GetMappedPrimitiveType(
((PrimitiveType)map.EdmItem).PrimitiveTypeKind, DataSpace.CSpace);
if (primitiveType != null)
{
typeUsage = EdmProviderManifest.Instance.GetCanonicalModelTypeUsage(primitiveType.PrimitiveTypeKind);
}
}
else
{
Debug.Assert(((GlobalItem)map.EdmItem).DataSpace == DataSpace.CSpace);
typeUsage = GetMappedTypeUsage(map);
}
}
return (null != typeUsage);
}
开发者ID:christiandpena,项目名称:entityframework,代码行数:37,代码来源:ClrPerspective.cs
示例3: DbUnaryExpression
internal DbUnaryExpression(DbExpressionKind kind, TypeUsage resultType, DbExpression argument)
: base(kind, resultType)
{
Debug.Assert(argument != null, "DbUnaryExpression.Argument cannot be null");
_argument = argument;
}
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:7,代码来源:DbUnaryExpression.cs
示例4: GetEdmType
public override TypeUsage GetEdmType(TypeUsage storeType)
{
if (storeType == null)
{
throw new ArgumentNullException("storeType");
}
string storeTypeName = storeType.EdmType.Name.ToLowerInvariant();
if (!base.StoreTypeNameToEdmPrimitiveType.ContainsKey(storeTypeName))
{
throw new ArgumentException(String.Format("The underlying provider does not support the type '{0}'.", storeTypeName));
}
PrimitiveType edmPrimitiveType = base.StoreTypeNameToEdmPrimitiveType[storeTypeName];
if (edmPrimitiveType.PrimitiveTypeKind == PrimitiveTypeKind.Binary)
{
return TypeUsage.CreateBinaryTypeUsage(edmPrimitiveType, false);
}
if (edmPrimitiveType.PrimitiveTypeKind == PrimitiveTypeKind.String)
{
Facet facet;
if (storeType.Facets.TryGetValue("MaxLength", false, out facet) && !facet.IsUnbounded && facet.Value != null)
return TypeUsage.CreateStringTypeUsage(edmPrimitiveType, false, false, (int)facet.Value);
else
return TypeUsage.CreateStringTypeUsage(edmPrimitiveType, false, false);
}
return TypeUsage.CreateDefaultTypeUsage(edmPrimitiveType);
}
开发者ID:pejmrivas,项目名称:sycket,代码行数:32,代码来源:ProviderManifest.cs
示例5: DbUnaryExpression
internal DbUnaryExpression(DbExpressionKind kind, TypeUsage resultType, DbExpression argument)
: base(kind, resultType)
{
DebugCheck.NotNull(argument);
_argument = argument;
}
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:7,代码来源:DbUnaryExpression.cs
示例6: ResolveCanonicalFunction
private static EdmFunction ResolveCanonicalFunction(string functionName, TypeUsage[] argumentTypes)
{
DebugCheck.NotEmpty(functionName);
var functions = new List<EdmFunction>(
EdmProviderManifest.Instance.GetStoreFunctions().Where(
func => string.Equals(func.Name, functionName, StringComparison.Ordinal))
);
EdmFunction foundFunction = null;
var ambiguous = false;
if (functions.Count > 0)
{
foundFunction = FunctionOverloadResolver.ResolveFunctionOverloads(functions, argumentTypes, false, out ambiguous);
if (ambiguous)
{
throw new ArgumentException(Strings.Cqt_Function_CanonicalFunction_AmbiguousMatch(functionName));
}
}
if (foundFunction == null)
{
throw new ArgumentException(Strings.Cqt_Function_CanonicalFunction_NotFound(functionName));
}
return foundFunction;
}
开发者ID:jwanagel,项目名称:jjwtest,代码行数:27,代码来源:EdmFunctions.cs
示例7: ColumnModel
/// <summary>
/// Initializes a new instance of the class.
/// </summary>
/// <param name = "type">The data type for this column.</param>
/// <param name = "typeUsage">
/// Additional details about the data type.
/// This includes details such as maximum length, nullability etc.
/// </param>
public ColumnModel(PrimitiveTypeKind type, TypeUsage typeUsage)
{
_type = type;
_typeUsage = typeUsage;
_clrType = PrimitiveType.GetEdmPrimitiveType(_type).ClrEquivalentType;
_clrDefaultValue = CreateDefaultValue();
}
开发者ID:jimmy00784,项目名称:entityframework,代码行数:15,代码来源:ColumnModel.cs
示例8: EdmMember
/// <summary>
/// Initializes a new instance of EdmMember class
/// </summary>
/// <param name="name">name of the member</param>
/// <param name="memberTypeUsage">type information containing info about member's type and its facet</param>
internal EdmMember(string name, TypeUsage memberTypeUsage)
{
EntityUtil.CheckStringArgument(name, "name");
EntityUtil.GenericCheckArgumentNull(memberTypeUsage, "memberTypeUsage");
_name = name;
_typeUsage = memberTypeUsage;
}
开发者ID:jimmy00784,项目名称:entityframework,代码行数:12,代码来源:EdmMember.cs
示例9: GetEdmType
public override TypeUsage GetEdmType(TypeUsage storeType)
{
string storeTypeName = storeType.EdmType.Name.ToLower();
PrimitiveType edmPrimitiveType = base.StoreTypeNameToEdmPrimitiveType[storeTypeName];
if (storeTypeName == "string" || storeTypeName == "varchar")
{
Facet f;
int maxLength = -1;
if (storeType.Facets.TryGetValue("MaxLength", false, out f) && !f.IsUnbounded && f.Value != null)
maxLength = (int)f.Value;
if (maxLength != -1)
return TypeUsage.CreateStringTypeUsage(edmPrimitiveType, false, false, maxLength);
else
return TypeUsage.CreateStringTypeUsage(edmPrimitiveType, false, false);
}
else if (storeTypeName == "decimal" || storeTypeName == "numeric")
{
Facet f;
byte precision = 0;
if (storeType.Facets.TryGetValue("Precision", false, out f) && !f.IsUnbounded && f.Value != null)
precision = (byte)f.Value;
byte scale = 0;
if (storeType.Facets.TryGetValue("Scale", false, out f) && !f.IsUnbounded && f.Value != null)
scale = (byte)f.Value;
if (precision != 0 && scale != 0)
return TypeUsage.CreateDecimalTypeUsage(edmPrimitiveType, precision, scale);
else
return TypeUsage.CreateDecimalTypeUsage(edmPrimitiveType);
}
else
return TypeUsage.CreateDefaultTypeUsage(edmPrimitiveType);
throw new NotImplementedException();
}
开发者ID:biegomar,项目名称:nuodb-dotnet,代码行数:33,代码来源:NuoDbProviderManifest.cs
示例10: NavigationProperty
/// <summary>
/// Initializes a new instance of the navigation property class
/// </summary>
/// <param name="name">name of the navigation property</param>
/// <param name="typeUsage">TypeUsage object containing the navigation property type and its facets</param>
/// <exception cref="System.ArgumentNullException">Thrown if name or typeUsage arguments are null</exception>
/// <exception cref="System.ArgumentException">Thrown if name argument is empty string</exception>
internal NavigationProperty(string name, TypeUsage typeUsage)
: base(name, typeUsage)
{
EntityUtil.CheckStringArgument(name, "name");
EntityUtil.GenericCheckArgumentNull(typeUsage, "typeUsage");
_accessor = new NavigationPropertyAccessor(name);
}
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:14,代码来源:NavigationProperty.cs
示例11: ResolveCanonicalFunction
private static EdmFunction ResolveCanonicalFunction(string functionName, TypeUsage[] argumentTypes)
{
Debug.Assert(!string.IsNullOrEmpty(functionName), "Function name must not be null");
List<EdmFunction> functions = new List<EdmFunction>(
System.Linq.Enumerable.Where(
EdmProviderManifest.Instance.GetStoreFunctions(),
func => string.Equals(func.Name, functionName, StringComparison.Ordinal))
);
EdmFunction foundFunction = null;
bool ambiguous = false;
if (functions.Count > 0)
{
foundFunction = EntitySql.FunctionOverloadResolver.ResolveFunctionOverloads(functions, argumentTypes, false, out ambiguous);
if (ambiguous)
{
throw EntityUtil.Argument(Strings.Cqt_Function_CanonicalFunction_AmbiguousMatch(functionName));
}
}
if (foundFunction == null)
{
throw EntityUtil.Argument(Strings.Cqt_Function_CanonicalFunction_NotFound(functionName));
}
return foundFunction;
}
开发者ID:uQr,项目名称:referencesource,代码行数:28,代码来源:EdmFunctions.cs
示例12: CollectionType
/// <summary>
/// The constructor for constructing a CollectionType object with the element type (as a TypeUsage) it contains
/// </summary>
/// <param name="elementType">The element type that this collection type contains</param>
/// <exception cref="System.ArgumentNullException">Thrown if the argument elementType is null</exception>
internal CollectionType(TypeUsage elementType)
: base(GetIdentity(EntityUtil.GenericCheckArgumentNull(elementType, "elementType")),
EdmConstants.TransientNamespace, elementType.EdmType.DataSpace)
{
_typeUsage = elementType;
SetReadOnly();
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:12,代码来源:CollectionType.cs
示例13: MapPrimitivePropertyFacets
internal static void MapPrimitivePropertyFacets(
EdmProperty property, EdmProperty column, TypeUsage typeUsage)
{
DebugCheck.NotNull(property);
DebugCheck.NotNull(column);
DebugCheck.NotNull(typeUsage);
if (IsValidFacet(typeUsage, XmlConstants.FixedLengthElement))
{
column.IsFixedLength = property.IsFixedLength;
}
if (IsValidFacet(typeUsage, XmlConstants.MaxLengthElement))
{
column.IsMaxLength = property.IsMaxLength;
column.MaxLength = property.MaxLength;
}
if (IsValidFacet(typeUsage, XmlConstants.UnicodeElement))
{
column.IsUnicode = property.IsUnicode;
}
if (IsValidFacet(typeUsage, XmlConstants.PrecisionElement))
{
column.Precision = property.Precision;
}
if (IsValidFacet(typeUsage, XmlConstants.ScaleElement))
{
column.Scale = property.Scale;
}
}
开发者ID:jwanagel,项目名称:jjwtest,代码行数:33,代码来源:StructuralTypeMappingGenerator.cs
示例14: Symbol
// <summary>
// Use this constructor if the symbol represents a SqlStatement for which the output columns need to be tracked.
// </summary>
public Symbol(string name, TypeUsage type, Dictionary<string, Symbol> outputColumns, bool outputColumnsRenamed)
{
this.name = name;
NewName = name;
Type = type;
this.outputColumns = outputColumns;
OutputColumnsRenamed = outputColumnsRenamed;
}
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:11,代码来源:Symbol.cs
示例15: DbFunctionAggregate
internal DbFunctionAggregate(TypeUsage resultType, DbExpressionList arguments, EdmFunction function, bool isDistinct)
: base(resultType, arguments)
{
DebugCheck.NotNull(function);
_aggregateFunction = function;
_distinct = isDistinct;
}
开发者ID:christiandpena,项目名称:entityframework,代码行数:8,代码来源:DbFunctionAggregate.cs
示例16: NavigationProperty
// <summary>
// Initializes a new instance of the navigation property class
// </summary>
// <param name="name"> name of the navigation property </param>
// <param name="typeUsage"> TypeUsage object containing the navigation property type and its facets </param>
// <exception cref="System.ArgumentNullException">Thrown if name or typeUsage arguments are null</exception>
// <exception cref="System.ArgumentException">Thrown if name argument is empty string</exception>
internal NavigationProperty(string name, TypeUsage typeUsage)
: base(name, typeUsage)
{
Check.NotEmpty(name, "name");
Check.NotNull(typeUsage, "typeUsage");
_accessor = new NavigationPropertyAccessor(name);
}
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:15,代码来源:NavigationProperty.cs
示例17: GetEdmType
/// <summary>
/// This method maps the specified storage type and a set of facets for that type
/// to an EDM type.
/// </summary>
/// <param name="storeType">
/// The <see cref="T:System.Data.Metadata.Edm.TypeUsage" /> instance that describes
/// a storage type and a set of facets for that type to be mapped to the EDM type.
/// </param>
/// <returns>
/// The <see cref="T:System.Data.Metadata.Edm.TypeUsage" /> instance that describes
/// an EDM type and a set of facets for that type.
/// </returns>
public override TypeUsage GetEdmType(TypeUsage storeType)
{
string name = storeType.EdmType.Name.ToLowerInvariant();
PrimitiveType edmType = this.StoreTypeNameToEdmPrimitiveType[name];
return ConvertTypeUsage(storeType, edmType);
}
开发者ID:RoboCafaz,项目名称:effort,代码行数:20,代码来源:EffortProviderManifest.cs
示例18: MetadataEnumMember
internal MetadataEnumMember(string name, TypeUsage enumType, EnumMember enumMember)
: base(MetadataMemberClass.EnumMember, name)
{
Debug.Assert(enumType != null, "enumType must not be null");
Debug.Assert(enumMember != null, "enumMember must not be null");
EnumType = enumType;
EnumMember = enumMember;
}
开发者ID:WangWilliam,项目名称:EntityFramework5,代码行数:8,代码来源:MetadataEnumMember.cs
示例19: MetadataEnumMember
internal MetadataEnumMember(string name, TypeUsage enumType, EnumMember enumMember)
: base(MetadataMemberClass.EnumMember, name)
{
DebugCheck.NotNull(enumType);
DebugCheck.NotNull(enumMember);
EnumType = enumType;
EnumMember = enumMember;
}
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:8,代码来源:MetadataEnumMember.cs
示例20: FunctionParameter
/// <summary>
/// The constructor for FunctionParameter taking in a name and a TypeUsage object
/// </summary>
/// <param name="name">The name of this FunctionParameter</param>
/// <param name="typeUsage">The TypeUsage describing the type of this FunctionParameter</param>
/// <param name="parameterMode">Mode of the parameter</param>
/// <exception cref="System.ArgumentNullException">Thrown if name or typeUsage arguments are null</exception>
/// <exception cref="System.ArgumentException">Thrown if name argument is empty string</exception>
internal FunctionParameter(string name, TypeUsage typeUsage, ParameterMode parameterMode)
{
EntityUtil.CheckStringArgument(name, "name");
EntityUtil.GenericCheckArgumentNull(typeUsage, "typeUsage");
_name = name;
_typeUsage = typeUsage;
SetParameterMode(parameterMode);
}
开发者ID:jimmy00784,项目名称:entityframework,代码行数:16,代码来源:FunctionParameter.cs
注:本文中的TypeUsage类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论