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


C# ITypeMapper.GetType方法代码示例

本文整理汇总了C#中ITypeMapper.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# ITypeMapper.GetType方法的具体用法?C# ITypeMapper.GetType怎么用?C# ITypeMapper.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITypeMapper的用法示例。


在下文中一共展示了ITypeMapper.GetType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TypeInfo

        /// <summary>
        /// Initialize a new object.
        /// </summary>
        /// <param name="nativeDbType">Native database type as used in stored procedures.</param>
        /// <param name="typeMapper">Mapps native to target data types and renders code items associated with data type.</param>
        /// <param name="precision">Native DB type precision - if applicable.</param>
        /// <param name="scale">Native DB type scale - if applicable.</param>
        public TypeInfo(string nativeDbType, ITypeMapper typeMapper, int precision, int scale)
        {
            this.typeMapper = typeMapper;
            this.precision = precision;
            this.scale = scale;

            this.NativeDbType = typeMapper.NativeDbType(nativeDbType);
            this.IsVariableLengthNativeType = typeMapper.IsVariableLengthNativeType(nativeDbType);
            this.Type = typeMapper.Type(nativeDbType, precision, scale);
            this.DefaultValue = typeMapper.DefaultValue(nativeDbType, precision, scale);
            this.IsValueType = typeMapper.IsValueType(nativeDbType);
            this.DbType = typeMapper.DbType(nativeDbType);
            this.NullableType = typeMapper.NullableType(nativeDbType, precision, scale);
            this.NullValue = typeMapper.NullValue(nativeDbType, precision, scale);
            this.DataType = typeMapper.GetType(nativeDbType, precision, scale);
        }
开发者ID:lordfist,项目名称:FistCore.Lib,代码行数:23,代码来源:TypeInfo.cs

示例2: AddTypeMapper

 /// <summary>
 /// Adds a type mapper to the chain with given priority. If mapper privided as an external MBean, the
 /// <paramref name="objectName"/> arguments is the name of this MBean; otherwise it is null.
 /// </summary>
 /// <param name="mapper">The mapper instance. In case of external mapper this is a reference to proxy of the MBean.</param>
 /// <param name="objectName">In case of external mapper, this is its <see cref="ObjectName"/>.</param>
 /// <param name="priority">The priority of a mapper. Must be unique.</param>
 /// <exception cref="NonUniquePriorityException">Another mapper with privided priority is already registered.</exception>
 public void AddTypeMapper(ITypeMapper mapper, ObjectName objectName, int priority)
 {
     TypeMapperInfo newMapperInfo = new TypeMapperInfo(priority, objectName == null ? mapper.GetType().AssemblyQualifiedName : null, objectName);
      if (_mappers.ContainsKey(priority))
      {
     TypeMapperInfo exisingMapperInfo = _mapperInfos.Find(delegate(TypeMapperInfo info)
                                                             {
                                                                return info.Priority == priority;
                                                             });
     throw new NonUniquePriorityException(
        newMapperInfo.ObjectName != null ? newMapperInfo.ObjectName.ToString() : newMapperInfo.TypeName,
        exisingMapperInfo.ObjectName != null ? exisingMapperInfo.ObjectName.ToString() : exisingMapperInfo.TypeName,
        priority
        );
      }
      _mappers.Add(priority, mapper);
      _mapperInfos.Add(newMapperInfo);
 }
开发者ID:SzymonPobiega,项目名称:NetMX,代码行数:26,代码来源:OpenTypeCache.cs

示例3: GenerateType

        private static IGeneratedType GenerateType(ModuleBuilder moduleBuilder, ITypeDescription typeDescription, ITypeMapper typeMapper)
        {
            var typeBuilder = moduleBuilder.DefineType(typeDescription.Name, TypeAttributes.Public | TypeAttributes.Class);

            typeBuilder.DefineDefaultConstructor(MethodAttributes.Public);

            var types = typeDescription.PropertyDescriptions.Select(x => x.Type).ToArray();
            var constructorBuilder = typeBuilder.DefineConstructor(MethodAttributes.Public, CallingConventions.Standard, types);

            var index = 1;
            foreach (var property in typeDescription.PropertyDescriptions)
            {
                constructorBuilder.DefineParameter(index, ParameterAttributes.None, property.Name.LowercaseFirst());
                index++;
            }

            var ctorIl = constructorBuilder.GetILGenerator();
            ctorIl.Emit(OpCodes.Ldarg_0);
            ctorIl.Emit(OpCodes.Call, typeBuilder.BaseType.GetConstructor(Type.EmptyTypes));

            index = 1;
            foreach (var property in typeDescription.PropertyDescriptions)
            {
                var targetPropertyType = typeMapper.GetType(property.Type);
                EmitForPropertyDescription(typeBuilder, property, ctorIl, index, targetPropertyType);
                index++;
            }

            ctorIl.Emit(OpCodes.Ret);

            var type = typeBuilder.CreateType();
            return new GeneratedType(typeDescription.Name, type, typeDescription);
        }
开发者ID:rjasica,项目名称:RuntimePocoGenerator,代码行数:33,代码来源:PocoEmitGenertor.cs


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