Esempio n. 1
0
 private static Action <CdmGenerationOptions> MapCliOptionsToCdmGenerationOptions(BaseOptions cliOptions)
 {
     return((genOptions) =>
     {
         genOptions.ManifestName = cliOptions.ManifestName;
         genOptions.OverrideExistingManifest = cliOptions.OverrideExistingManifest;
         genOptions.EntitiesVersion = cliOptions.EntitiesVersion;
         genOptions.OutputFolder = cliOptions.OutputCdmFolder;
         genOptions.HasVirtualPartition = cliOptions.HasVirtualPartition;
         genOptions.HasTimestamps = cliOptions.HasTimestamps;
     });
 }
Esempio n. 2
0
        public static IServiceCollection ConfigureCommonServices(this IServiceCollection services, BaseOptions cliOptions)
        {
            services.AddLogging(configure => configure.AddConsole())
            .Configure <LoggerFilterOptions>(o => o.MinLevel = cliOptions.LogLevel);

            services.AddScoped <SqlRelationalModelAnnotationCombiner>();

            services.AddScoped <CdmGenerator>();

            services.AddOptions <CdmGenerationOptions>()
            .Configure(MapCliOptionsToCdmGenerationOptions(cliOptions))
            .ValidateDataAnnotations();

            services.AddScoped <SqlAnnotationTypeAliasMapper>();

            services.AddOptions <SqlAnnotationTypeAliasOptions>()
            .Configure(o => o.Alias = cliOptions.Alias)
            .ValidateDataAnnotations();


            return(services);
        }