• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# ITypeMapper类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: InitializeTypeMapper

        public void InitializeTypeMapper(ITypeMapper typeMapper)
        {
            var thisAssembly = Assembly.GetAssembly(GetType());

            foreach (var type in thisAssembly.GetTypes())
            {
                if (!type.IsConcrete())
                    continue;

                var interfaceName = "I" + type.Name;

                var interface_ = type.GetInterface(interfaceName);

                if (interface_ == null)
                    continue;

                // This was tricky to figure out, just getting the interface will get
                // you the generic type w/o generic parameters, not the generic type
                // definition.
                var mappedInterface = (interface_.IsGenericType)
                                          ? interface_.GetGenericTypeDefinition()
                                          : interface_;

                var mappedType = (type.IsGenericType)
                                     ? type.GetGenericTypeDefinition()
                                     : type;

                typeMapper.Map(mappedInterface, mappedType);
            }
        }
开发者ID:peteyoung,项目名称:Testify,代码行数:30,代码来源:IInterfaceConventionInitializer.cs


示例2: DataSourceRootNode

 public DataSourceRootNode(ITypeMapper typeMapper, IPomonaDataSource dataSource)
     : base(typeMapper, null, "/")
 {
     if (dataSource == null)
         throw new ArgumentNullException("dataSource");
     this.dataSource = dataSource;
 }
开发者ID:BeeWarloc,项目名称:Pomona,代码行数:7,代码来源:DataSourceRootNode.cs


示例3: NewDelegate

		public NewDelegate(Type delegateType, Operand target, string methodName, ITypeMapper typeMapper)
		{
			_delegateType = delegateType;
			_target = target;
		    _typeMapper = typeMapper;
		    Initialize(target.GetReturnType(typeMapper), methodName);
		}
开发者ID:AqlaSolutions,项目名称:runsharp,代码行数:7,代码来源:NewDelegate.cs


示例4: GetDeleteSql

        public string GetDeleteSql(ITypeMapper mapper, string whereSql)
        {
            if (string.IsNullOrEmpty(whereSql))
                return string.Format("Delete From {0}", DecorateName(mapper.TableName));

            return string.Format("Delete From {0} Where {1}", DecorateName(mapper.TableName), whereSql);
        }
开发者ID:BeanHsiang,项目名称:Greedy,代码行数:7,代码来源:SqlGenerator.cs


示例5: InitializeTypeMapper

        public void InitializeTypeMapper(ITypeMapper typeMapper)
        {
            typeMapper.Map<IList, ArrayList>();
            typeMapper.Map<IDictionary, Hashtable>();

            typeMapper.Map(typeof(IList<>), typeof(List<>));
            typeMapper.Map(typeof(IDictionary<,>), typeof(Dictionary<,>));
        }
开发者ID:peteyoung,项目名称:Testify,代码行数:8,代码来源:CollectionMappingInitializer.cs


示例6: UriResolver

 public UriResolver(ITypeMapper typeMapper, IBaseUriProvider baseUriProvider)
 {
     if (typeMapper == null)
         throw new ArgumentNullException("typeMapper");
     if (baseUriProvider == null)
         throw new ArgumentNullException("baseUriProvider");
     this.typeMapper = typeMapper;
     this.baseUriProvider = baseUriProvider;
 }
开发者ID:BeeWarloc,项目名称:Pomona,代码行数:9,代码来源:UriResolver.cs


示例7: PomonaHttpQueryTransformer

 public PomonaHttpQueryTransformer(ITypeMapper typeMapper, QueryExpressionParser parser)
 {
     if (typeMapper == null)
         throw new ArgumentNullException("typeMapper");
     if (parser == null)
         throw new ArgumentNullException("parser");
     this.typeMapper = typeMapper;
     this.parser = parser;
 }
开发者ID:BeeWarloc,项目名称:Pomona,代码行数:9,代码来源:PomonaHttpQueryTransformer.cs


示例8: Delta

 protected Delta(object original, TypeSpec type, ITypeMapper typeMapper, Delta parent = null)
 {
     if (original == null) throw new ArgumentNullException("original");
     if (type == null) throw new ArgumentNullException("type");
     if (typeMapper == null) throw new ArgumentNullException("typeMapper");
     Original = original;
     Type = type;
     TypeMapper = typeMapper;
     this.parent = parent;
 }
开发者ID:BeeWarloc,项目名称:Pomona,代码行数:10,代码来源:Delta.cs


示例9: Creator

        public static ITypeMapper Creator()
        {
            if (instance == null)
            {
                string typeName = ConfigManager.SettingsSection.AppSettings["typeMapper"].Value;
                instance = (ITypeMapper)Activator.CreateInstance(Type.GetType(typeName));
            }

            return instance;
        }
开发者ID:peterchen,项目名称:CodeBuilder,代码行数:10,代码来源:TypeMapperFactory.cs


示例10: InsertDataCommand

 public InsertDataCommand(ICommandPerformer<string> exec, ICache cache, ITypeMapper mapper, EntityData value)
 {
     this.value = value;
     this.cache = cache;
     this.executor = exec;
     this.schema = cache.Pick<Document>();
     this.nameSpace = schema.Settings[Keys.Namespace];
     this.mapper = mapper;
     this.properties = schema.Entities.Single(x => x.Name == value.EntityName).Properties;
 }
开发者ID:Udgin,项目名称:datagenerator,代码行数:10,代码来源:InsertDataCommand.cs


示例11: PathNode

 protected PathNode(ITypeMapper typeMapper, PathNode parent, string name)
 {
     if (typeMapper == null)
         throw new ArgumentNullException("typeMapper");
     if (name == null)
         throw new ArgumentNullException("name");
     this.typeMapper = typeMapper;
     this.parent = parent;
     this.name = name;
 }
开发者ID:BeeWarloc,项目名称:Pomona,代码行数:10,代码来源:PathNode.cs


示例12: Initialize

        void Initialize(ITypeMapper typeMapper)
        {
            if (_initialized) return;
            _initialized = true;

            // TODO: proper checking as in specification
            if (_ifTrue.GetReturnType(typeMapper) != _ifFalse.GetReturnType(typeMapper))
                throw new ArgumentException(Properties.Messages.ErrInvalidConditionalVariants);

            if (_cond.GetReturnType(typeMapper) != typeMapper.MapType(typeof(bool))) _cond = _cond.IsTrue();
        }
开发者ID:AqlaSolutions,项目名称:runsharp,代码行数:11,代码来源:Conditional.cs


示例13: CreateContext

        public void CreateContext()
        {
            _typeMapper = new Moq.Mock<ITypeMapper>().Object;
            _random = new Moq.Mock<IRandom>().Object;
            _idGenerator = new Moq.Mock<IIdGenerator>().Object;

            var context = Create();

            Assert.That(context.TypeMapper, Is.Not.Null);
            Assert.That(context.Random, Is.Not.Null);
            Assert.That(context.IdGenerator, Is.Not.Null);
        }
开发者ID:andy-uq,项目名称:Echo,代码行数:12,代码来源:ContextTests.cs


示例14: ResourceResolver

 public ResourceResolver(ITypeMapper typeMapper, NancyContext context, IRouteResolver routeResolver)
 {
     if (typeMapper == null)
         throw new ArgumentNullException("typeMapper");
     if (context == null)
         throw new ArgumentNullException("context");
     if (routeResolver == null)
         throw new ArgumentNullException("routeResolver");
     //if (routeResolver == null) throw new ArgumentNullException("routeResolver");
     this.typeMapper = typeMapper;
     this.context = context;
     this.routeResolver = routeResolver;
 }
开发者ID:BeeWarloc,项目名称:Pomona,代码行数:13,代码来源:ResourceResolver.cs


示例15: GenerateTypes

        public IEnumerable<IGeneratedType> GenerateTypes(IEnumerable<ITypeDescription> typeDescriptions, ITypeMapper typeMapper)
        {
            if (typeDescriptions == null)
            {
                throw new ArgumentNullException("typeDescriptions");
            }

            if (typeMapper == null)
            {
                throw new ArgumentNullException("typeMapper");
            }

            Validate(typeDescriptions);

            var name = "PocoAssembly";
            var assemblyName = new AssemblyName(name);
            var appDomain = Thread.GetDomain();

            AssemblyBuilder assemblyBuilder;
            ModuleBuilder moduleBuilder;

            if (this.getTypeFromDiskAssembly)
            {
                assemblyBuilder = appDomain.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.RunAndSave);
                moduleBuilder = assemblyBuilder.DefineDynamicModule(assemblyName.Name, this.assemblyName);
            }
            else
            {
                assemblyBuilder = appDomain.DefineDynamicAssembly(assemblyName, AssemblyBuilderAccess.Run);
                moduleBuilder = assemblyBuilder.DefineDynamicModule(assemblyName.Name);
            }

            var generatedTypes = new List<IGeneratedType>();
            foreach (var typeDescription in typeDescriptions)
            {
                var result = GenerateType(moduleBuilder, typeDescription, typeMapper);
                typeMapper.RegisterNewType(typeDescription, result);
                generatedTypes.Add(result);
            }

            if (this.getTypeFromDiskAssembly)
            {
                var generatedConvertedTypes = this.LoadFromDisk(assemblyBuilder, generatedTypes);

                return generatedConvertedTypes;
            }
            else
            {
                return generatedTypes;
            }
        }
开发者ID:rjasica,项目名称:RuntimePocoGenerator,代码行数:51,代码来源:PocoEmitGenertor.cs


示例16: SetFrameworkOptions

 /// <summary>
 /// Import framework options from an existing type
 /// </summary>
 public void SetFrameworkOptions(Type from, ITypeMapper mapper)
 {
     if (@from == null) throw new ArgumentNullException(nameof(@from));
     AttributeMap[] attribs = AttributeMap.Create(mapper, @from.Assembly);
     foreach (AttributeMap attrib in attribs)
     {
         if (attrib.AttributeType.FullName == "System.Runtime.Versioning.TargetFrameworkAttribute")
         {
             object tmp;
             if (attrib.TryGet("FrameworkName", out tmp)) TargetFrameworkName = (string)tmp;
             if (attrib.TryGet("FrameworkDisplayName", out tmp)) TargetFrameworkDisplayName = (string)tmp;
             break;
         }
     }
 }
开发者ID:AqlaSolutions,项目名称:runsharp,代码行数:18,代码来源:CompilerOptions.cs


示例17: 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


示例18: ResourceNode

 public ResourceNode(ITypeMapper typeMapper,
     PathNode parent,
     string name,
     Func<object> valueFetcher,
     ResourceType expectedType)
     : base(typeMapper, parent, name)
 {
     this.value = new System.Lazy<object>(valueFetcher);
     this.expectedType = expectedType;
     this.type = new System.Lazy<ResourceType>(() =>
     {
         var localValue = Value;
         if (Value == null)
             return expectedType;
         return (ResourceType)typeMapper.GetClassMapping(localValue.GetType());
     });
 }
开发者ID:BeeWarloc,项目名称:Pomona,代码行数:17,代码来源:ResourceNode.cs


示例19: 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


示例20: Generator

        public Generator(IPocoGenertor pocoGenerator, ITypeMapper typeMapper)
        {
            if (pocoGenerator == null)
            {
                throw new ArgumentNullException("pocoGenerator");
            }

            this.typeCache = new Dictionary<Type, IGeneratedType>();
            this.typeDescritpionCache = new Dictionary<ITypeDescription, IGeneratedType>();
            this.methodCache = new Dictionary<MethodInfo, IGeneratedType>();
            this.typeMapper = typeMapper;
            this.pocoGenerator = pocoGenerator;

            if (this.typeMapper == null)
            {
                this.typeMapper = new DefaultTypeMapper(this.typeDescritpionCache);
            }
        }
开发者ID:rjasica,项目名称:RuntimePocoGenerator,代码行数:18,代码来源:Generator.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ITypeNode类代码示例发布时间:2022-05-24
下一篇:
C# ITypeInfo类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap