コード例 #1
0
        private static SourceUnit GenerateResultToResponseMapper(string responseTypeName, Type resultType)
        {
            AutomapperProfilerBuilder profile = new AutomapperProfilerBuilder()
                                                .InNamespace(resultType.Namespace + ".WebApi.Profiles")
                                                .ForType(responseTypeName, resultType.Name)
                                                .WithDefaultUsings()
                                                .AddUsing(resultType.Namespace)
                                                .AddUsing(resultType.Namespace + ".WebApi");

            profile.WithDefaultMapping();

            return(new SourceUnit(profile.Namespace, profile.Name, profile.GenerateCode()));
        }
コード例 #2
0
        private static SourceUnit GenerateRequestToCommandMapper(string requestType, Type commandType, Type exPropType, string exPropName)
        {
            AutomapperProfilerBuilder profile = new AutomapperProfilerBuilder()
                                                .InNamespace(commandType.Namespace + ".WebApi.Profiles")
                                                .ForType(commandType.Name, requestType)
                                                .WithDefaultUsings()
                                                .AddUsing(commandType.Namespace)
                                                .AddUsing(commandType.Namespace + ".WebApi");

            profile.WithDefaultMapping()
            .WithValueMapping(exPropType, exPropName)
            .AddIgnore(exPropName);

            return(new SourceUnit(profile.Namespace, profile.Name, profile.GenerateCode()));
        }