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


C# ITypeMapper类代码示例

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


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


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