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


C# TypeMap类代码示例

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


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

示例1: CreateModelSQLEmit

 public IModelSQLEmit CreateModelSQLEmit(IObjectMapInfoCache cache)
 {
     ITypeMap tm = new TypeMap();
     ISQLTranslator tr = new SQLTranslator();
     IModelColumnsBuilder cb = new ModelColumnsBuilder(tr, tm);
     return new ModelSQLEmit(cache, tr, tm, cb);
 }
开发者ID:rexzh,项目名称:RexToy,代码行数:7,代码来源:DialectProvider.cs

示例2: CreateDestinationFunc

        private static Expression CreateDestinationFunc(
            TypeMap typeMap,
            TypeMapRegistry typeMapRegistry,
            ParameterExpression srcParam,
            ParameterExpression destParam,
            ParameterExpression ctxtParam)
        {
            var newDestFunc = ToType(CreateNewDestinationFunc(typeMap, typeMapRegistry, srcParam, ctxtParam),
                typeMap.DestinationTypeToUse);

            var getDest = typeMap.DestinationTypeToUse.GetTypeInfo().IsValueType
                ? newDestFunc
                : Coalesce(destParam, newDestFunc);

            Expression destinationFunc = Assign(destParam, getDest);

            if (typeMap.PreserveReferences)
            {
                var dest = Variable(typeof (object), "dest");

                Expression valueBag = Property(ctxtParam, "InstanceCache");
                var set = Assign(Property(valueBag, "Item", srcParam), dest);
                var setCache =
                    IfThen(NotEqual(srcParam, Constant(null)), set);

                destinationFunc = Block(new[] {dest}, Assign(dest, destinationFunc), setCache, dest);
            }
            return destinationFunc;
        }
开发者ID:284247028,项目名称:AutoMapper,代码行数:29,代码来源:TypeMapPlanBuilder.cs

示例3: Establish_context

            protected override void Establish_context()
            {
                _configuration = new Configuration(new TypeMapFactory(), MapperRegistry.AllMappers());
                _configuration.CreateMap<Source, Destination>();

                _expected = _configuration.FindTypeMapFor(null, typeof(Source), typeof(Destination));
            }
开发者ID:DeanMilojevic,项目名称:AutoMapper,代码行数:7,代码来源:ConfigurationSpecs.cs

示例4: MapByType

 public override void MapByType( Type t, TypeMap otm )
 {
     this.Context = otm;
     XmlDocument document = new XmlDocument();
     document.Load( this.MappingDocument );
     XmlNode node = document.SelectSingleNode( String.Format( "//type-map[@type={0}]", t.Name ) );
     otm.Table = node.Attributes["table"].InnerText;
 }
开发者ID:ikariiwarrior,项目名称:Alpaca,代码行数:8,代码来源:XmlMappingProvider.cs

示例5: BindCustomProjectionExpression

        private static MemberAssignment BindCustomProjectionExpression(PropertyMap propertyMap, TypeMap propertyTypeMap, ExpressionResolutionResult result)
        {
            var visitor = new ParameterReplacementVisitor(result.ResolutionExpression);

            var replaced = visitor.Visit(propertyTypeMap.CustomProjection.Body);

            return Expression.Bind(propertyMap.DestinationProperty.MemberInfo, replaced);
        }
开发者ID:gonzalogilrepositorio,项目名称:Proyecto-ComIT,代码行数:8,代码来源:CustomProjectionExpressionBinder.cs

示例6: First

        public void First()
        {
            var map = new TypeMap();

            ushort id;
            Assert.IsTrue (map.GetTypeId (typeof (string), out id));
            Assert.AreEqual (0, id);
        }
开发者ID:strager,项目名称:Tempest,代码行数:8,代码来源:TypeMapTests.cs

示例7: Construct

        public static NamedTypeSymbol Construct(this NamedTypeSymbol type, params TypeSymbol[] arguments)
        {
            Debug.Assert(type != null);
            Debug.Assert(arguments != null);
            TypeMap map = new TypeMap(ReadOnlyArray<TypeSymbol>.CreateFrom(type.ConstructedFrom.TypeParameters),
                                            arguments.AsReadOnly());

            return map.SubstituteNamedType(type.ConstructedFrom);
        }
开发者ID:EkardNT,项目名称:Roslyn,代码行数:9,代码来源:NamedTypeSymbolExtensions.cs

示例8: Configure

        public void Configure(TypeMap typeMap)
        {
            var sourcePropertyConfig = typeMap.FindOrCreateSourceMemberConfigFor(_sourceMember);

            foreach (var action in _sourceMemberActions)
            {
                action(sourcePropertyConfig);
            }
        }
开发者ID:284247028,项目名称:AutoMapper,代码行数:9,代码来源:SourceMappingExpression.cs

示例9: SPParameterConfig

 public SPParameterConfig(SPParameter parameter, TypeMap map)
 {
     Definition = parameter;
     FriendlyName = NamingHelpers.SplitObjectName(Definition.Name);
     IsRequired = Definition.DefaultValue == null;
     Type= map.GetCodeType(Definition.TypeInfo.TypeName);
     SampleValue = Definition.DefaultValue as String;
     Enabled = true;
 }
开发者ID:404htm,项目名称:FlightORM_Original,代码行数:9,代码来源:SPParameterConfig.cs

示例10: When_creating_a_new_context_from_an_existing_context_Should_preserve_context_type_map

        public void When_creating_a_new_context_from_an_existing_context_Should_preserve_context_type_map()
        {
            var map = new TypeMap(new TypeInfo(typeof(int)), new TypeInfo(typeof(string)), MemberList.Destination);

            var context = new ResolutionContext(map, 5, typeof(int), typeof(string), new MappingOperationOptions());

            ResolutionContext newContext = context.CreateValueContext(10);

            newContext.GetContextTypeMap().ShouldNotBeNull();
        }
开发者ID:nates1973,项目名称:AutoMapper,代码行数:10,代码来源:ResolutionContextTester.cs

示例11: TypeMapPlanBuilder

 public TypeMapPlanBuilder(IConfigurationProvider configurationProvider, TypeMapRegistry typeMapRegistry, TypeMap typeMap)
 {
     _configurationProvider = configurationProvider;
     _typeMapRegistry = typeMapRegistry;
     _typeMap = typeMap;
     _source = Parameter(typeMap.SourceType, "src");
     _initialDestination = Parameter(typeMap.DestinationTypeToUse, "dest");
     _context = Parameter(typeof(ResolutionContext), "ctxt");
     _destination = Variable(_initialDestination.Type, "typeMapDestination");
 }
开发者ID:tlycken,项目名称:AutoMapper,代码行数:10,代码来源:TypeMapPlanBuilder.cs

示例12: SPConfig

        internal SPConfig(SPInfo definition, ISPLoader loader, TypeMap typeMap)
        {
            _core = definition;
            _loader = loader;
            _typeMap = typeMap;

            //Defaults:
            FriendlyName = NamingHelpers.SplitObjectName(definition.Name);
            Enabled = true;
        }
开发者ID:404htm,项目名称:FlightORM_Original,代码行数:10,代码来源:SPConfig.cs

示例13: ToString_Always_Succeeds

        public void ToString_Always_Succeeds()
        {
            //Arrange
            var typeMap = new TypeMap(typeof(string), typeof(int));

            //Act
            string actual = typeMap.ToString();

            //Assert
            Assert.AreEqual<string>(string.Format("{{{0}, {1}}}", typeof(string), typeof(int)), actual);
        }
开发者ID:hennadiilu,项目名称:Nmap,代码行数:11,代码来源:TypeMapTesting.cs

示例14: Add_GoodValues_Succeeds

        public void Add_GoodValues_Succeeds()
        {
            //Arrange
            var typeMapCollection = new TypeMapCollection();
            var typeMap = new TypeMap(typeof(Type), typeof(Type));

            //Act
            typeMapCollection.Add(typeMap);

            //Assert
            Assert.AreEqual<TypeMapBase>(typeMap, typeMapCollection.Get(typeof(Type), typeof(Type)));
        }
开发者ID:hennadiilu,项目名称:Nmap,代码行数:12,代码来源:TypeMapCollectionTesting.cs

示例15: CtorTypeMap

        public void CtorTypeMap()
        {
            var map = new TypeMap();
            ushort id;
            map.GetTypeId (typeof (string), out id);
            map.GetTypeId (typeof (int), out id);

            var c = new MockClientConnection (new MockConnectionProvider (MockProtocol.Instance));

            var context = new SerializationContext (c, MockProtocol.Instance, map);

            Assert.AreSame (map, context.TypeMap);
        }
开发者ID:strager,项目名称:Tempest,代码行数:13,代码来源:SerializationContextTests.cs


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