本文整理汇总了C#中ITypeResolver类的典型用法代码示例。如果您正苦于以下问题:C# ITypeResolver类的具体用法?C# ITypeResolver怎么用?C# ITypeResolver使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ITypeResolver类属于命名空间,在下文中一共展示了ITypeResolver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EntitySetInfo
internal EntitySetInfo(IEdmModel edmModel, IEdmEntitySet edmEntitySet, ITypeResolver typeResolver)
{
Contract.Assert(edmModel != null);
Contract.Assert(edmEntitySet != null);
Contract.Assert(typeResolver != null);
Name = edmEntitySet.Name;
ElementType = new EntityTypeInfo(edmModel, edmEntitySet.ElementType, typeResolver);
var entityTypes = new List<EntityTypeInfo>(3) { ElementType };
// Create an EntityTypeInfo for any derived types in the model
foreach (var edmDerivedType in edmModel.FindAllDerivedTypes(edmEntitySet.ElementType).OfType<IEdmEntityType>())
{
entityTypes.Add(new EntityTypeInfo(edmModel, edmDerivedType, typeResolver));
}
// Connect any derived types with their base class
for (int i = 1; i < entityTypes.Count; ++i)
{
var baseEdmEntityType = entityTypes[i].EdmEntityType.BaseEntityType();
if (baseEdmEntityType != null)
{
var baseEntityTypeInfo = entityTypes.First(entityTypeInfo => entityTypeInfo.EdmEntityType == baseEdmEntityType);
if (baseEntityTypeInfo != null)
{
entityTypes[i].BaseTypeInfo = baseEntityTypeInfo;
}
}
}
EntityTypes = entityTypes;
}
示例2: CachedTypeResolver
/// <summary>
/// Creates a new instance of the <see cref="CachedTypeResolver"/> class.
/// </summary>
/// <param name="typeResolver">
/// The <see cref="ITypeResolver"/> that this instance will delegate
/// actual <see cref="System.Type"/> resolution to if a <see cref="System.Type"/>
/// cannot be found in this instance's <see cref="System.Type"/> cache.
/// </param>
/// <exception cref="System.ArgumentNullException">
/// If the supplied <paramref name="typeResolver"/> is <see langword="null"/>.
/// </exception>
public CachedTypeResolver(ITypeResolver typeResolver)
{
if (typeResolver == null)
throw new ArgumentNullException("typeResolver");
_typeResolver = typeResolver;
}
示例3: DebugPortableItem
public DebugPortableItem(ITypeResolver resolver, Vector2 pos)
: base(resolver, pos)
{
portable = new PortableProperty(this, 10, 10);
AddProperty(portable);
}
示例4: EnumerableTypeSpec
private EnumerableTypeSpec(ITypeResolver typeResolver, Type type, Lazy<TypeSpec> itemType)
: base(typeResolver, type)
{
if (itemType == null)
throw new ArgumentNullException(nameof(itemType));
this.itemType = itemType;
}
示例5: FieldAccessService
public FieldAccessService(IFieldAccessRightsExecutor accessRightsExecutor, IEnumerable<IFieldAccessRule> rules, ITypeResolver types, IServiceLocator services)
{
_accessRightsExecutor = accessRightsExecutor;
_types = types;
_services = services;
_rules.AddRange(rules);
}
示例6: GetEnumGetHashCodeMethod
public static void GetEnumGetHashCodeMethod(
IType enumType,
ITypeResolver typeResolver,
out object[] code,
out IList<object> tokenResolutions,
out IList<IType> locals,
out IList<IParameter> parameters)
{
Debug.Assert(enumType.ToNormal().IsEnum, "This is for enum only");
var codeList = new List<object>();
codeList.Add(Code.Ldarg_0);
codeList.AppendInt(Code.Ldfld, 1);
codeList.Add(Code.Conv_I4);
// return
codeList.Add(Code.Ret);
// End of Code
// tokens
tokenResolutions = new List<object>();
// data
tokenResolutions.Add(enumType.GetFieldByName("Value", typeResolver));
// locals
locals = new List<IType>();
// code
code = codeList.ToArray();
// parameters
parameters = new List<IParameter>();
}
示例7: DebugAttackableItem
public DebugAttackableItem(ITypeResolver resolver, Vector2 pos)
: base(resolver, pos, Angle.Right)
{
attackable = new AttackableProperty(this, 5, 100, 100);
AddProperty(attackable);
}
示例8: FullObjectGraphTraversalStrategy
public FullObjectGraphTraversalStrategy(Serializer serializer, ITypeInspector typeDescriptor, ITypeResolver typeResolver, int maxRecursion, INamingConvention namingConvention)
{
if (maxRecursion <= 0)
{
throw new ArgumentOutOfRangeException("maxRecursion", maxRecursion, "maxRecursion must be greater than 1");
}
this.serializer = serializer;
if (typeDescriptor == null)
{
throw new ArgumentNullException("typeDescriptor");
}
this.typeDescriptor = typeDescriptor;
if (typeResolver == null)
{
throw new ArgumentNullException("typeResolver");
}
this.typeResolver = typeResolver;
this.maxRecursion = maxRecursion;
this.namingConvention = namingConvention;
}
示例9: Register
public static void Register(ITypeResolver typeResolver)
{
var codeBuilder = new IlCodeBuilder();
codeBuilder.LoadArgument(0);
codeBuilder.Add(Code.Call, 1);
codeBuilder.Add(Code.Dup);
codeBuilder.LoadArgument(0);
codeBuilder.Add(Code.Stfld, 2);
codeBuilder.Add(Code.Ret);
var parameters = new List<IParameter>();
parameters.Add(typeResolver.System.System_Int32.ToParameter());
var tokenResolutions = new List<object>();
tokenResolutions.Add(
new SynthesizedStaticMethod(
string.Empty,
typeResolver.System.System_String,
typeResolver.System.System_String,
parameters,
(llvmWriter, opCode) => llvmWriter.WriteNewMethodBody(opCode, typeResolver.System.System_String, enableStringFastAllocation: true)));
tokenResolutions.Add(typeResolver.System.System_String.GetFieldByName("m_stringLength", typeResolver));
var locals = new List<IType>();
MethodBodyBank.Register(Name, codeBuilder.GetCode(), tokenResolutions, locals, parameters);
}
示例10: Register
public static void Register(ITypeResolver typeResolver)
{
var codeList = new List<object>();
codeList.AddRange(
new object[]
{
Code.Ldarg_0,
});
codeList.AppendInt(Code.Castclass, 1);
codeList.AppendInt(Code.Ldfld, 2);
codeList.Add(Code.Ret);
var arrayType = typeResolver.System.System_Byte.ToArrayType(1);
var tokenResolutions = new List<object>();
tokenResolutions.Add(arrayType);
tokenResolutions.Add(arrayType.GetFieldByName("rank", typeResolver));
var locals = new List<IType>();
var parameters = new List<IParameter>();
MethodBodyBank.Register(Name, codeList.ToArray(), tokenResolutions, locals, parameters);
}
示例11: SiteTreeGeneratorService
public SiteTreeGeneratorService(ILogger logger, ITypeResolver typeResolver, IParsedSourceStorageService cache, IParserFactory parserFactory)
{
_logger = logger;
_typeResolver = typeResolver;
_cache = cache;
_parserFactory = parserFactory;
}
示例12: XmlContentSerializer
/// <summary>
/// Initializes a new instance of the
/// <see cref="XmlContentSerializer"/> class.
/// </summary>
/// <param name="resolver">
/// An <see cref="ITypeResolver" /> used to resolve XML names to
/// <see cref="Type" /> instances, used when deserializing XML to
/// objects.
/// </param>
/// <exception cref="System.ArgumentNullException">
/// <paramref name="resolver" /> is <see langword="null" />.
/// </exception>
public XmlContentSerializer(ITypeResolver resolver)
{
if (resolver == null)
throw new ArgumentNullException("resolver");
this.resolver = resolver;
}
示例13: SynthesizedSingleDimArrayIListSetItemMethod
/// <summary>
/// </summary>
/// <param name="type">
/// </param>
/// <param name="typeResolver">
/// </param>
public SynthesizedSingleDimArrayIListSetItemMethod(IType arrayType, ITypeResolver typeResolver)
: base("set_Item", arrayType, typeResolver.System.System_Void)
{
var codeList = new IlCodeBuilder();
codeList.LoadArgument(0);
codeList.LoadArgument(1);
codeList.LoadArgument(2);
codeList.Add(Code.Stelem, 1);
codeList.Add(Code.Ret);
var locals = new List<IType>();
this._methodBody =
new SynthesizedMethodBodyDecorator(
null,
locals,
codeList.GetCode());
this._parameters = new List<IParameter>();
this._parameters.Add(typeResolver.System.System_Int32.ToParameter());
this._parameters.Add(arrayType.GetElementType().ToParameter());
this._tokenResolutions = new List<object>();
this._tokenResolutions.Add(arrayType.GetElementType());
}
示例14: DebugCarrierItem
public DebugCarrierItem(ITypeResolver resolver, Vector2 pos)
: base(resolver, pos)
{
carrier = new CarrierProperty(this, 10f);
AddProperty(carrier);
}
示例15: SynthesizedSingleDimArrayIListGetEnumeratorMethod
/// <summary>
/// </summary>
/// <param name="type">
/// </param>
/// <param name="typeResolver">
/// </param>
public SynthesizedSingleDimArrayIListGetEnumeratorMethod(IType arrayType, ITypeResolver typeResolver)
: base("GetEnumerator", arrayType, typeResolver.System.System_Collections_Generic_IEnumerator_T.Construct(arrayType.GetElementType()))
{
var codeList = new IlCodeBuilder();
codeList.LoadArgument(0);
codeList.Add(Code.Newobj, 1);
codeList.Add(Code.Newobj, 2);
codeList.Add(Code.Ret);
var locals = new List<IType>();
this._methodBody =
new SynthesizedMethodBodyDecorator(
null,
locals,
codeList.GetCode());
this._parameters = new List<IParameter>();
this._tokenResolutions = new List<object>();
var arraySegmentType = typeResolver.System.System_ArraySegment_T1.Construct(arrayType.GetElementType());
this._tokenResolutions.Add(
IlReader.Constructors(arraySegmentType, typeResolver).First(c => c.GetParameters().Count() == 1));
this._tokenResolutions.Add(
IlReader.Constructors(arraySegmentType.GetNestedTypes().First(), typeResolver).First(c => c.GetParameters().Count() == 1));
}