コード例 #1
0
ファイル: Module.cs プロジェクト: inelisoni/Arcanum.NsJson
 public static IMicroContractResolverBuilder AddStandardContracts(this IMicroContractResolverBuilder builder) =>
 builder
 .AddFactory <BasicJsonContractFactory>()
 .AddFactory <NullableStructJsonContractFactory>()
 .AddFactory <EnumJsonContractFactory>()
 .AddFactory <FlagsEnumJsonContractFactory>()
 .AddFactory <UnionJsonContractFactory>()
 .AddCreator <IPAddress, IpAddressJsonContractCreator>()
 .AddCreator <IPEndPoint, IpEndPointJsonContractCreator>()
 .AddCreator <DnsEndPoint, DnsEndPointJsonContractCreator>()
 .AddMiddlewareFactory <UnionCaseJsonMiddlewareFactory>();
コード例 #2
0
ファイル: Module.cs プロジェクト: inelisoni/Arcanum.NsJson
        public static IMicroContractResolverBuilder AddPlatformContracts(this IMicroContractResolverBuilder builder)
        {
            var assemblies = AppDomain.CurrentDomain.GetAssemblies();

            foreach (var assembly in assemblies)
            {
                var configurators = assembly.GetCustomAttributes <PlatformJsonContractConfigurator>();
                foreach (var configurator in configurators)
                {
                    configurator.ConfigurePlatformJsonContracts(builder);
                }
            }
            return(builder);
        }
コード例 #3
0
 public abstract void ConfigurePlatformJsonContracts(IMicroContractResolverBuilder builder);
コード例 #4
0
 /// <inheritdoc />
 public override void ConfigurePlatformJsonContracts(IMicroContractResolverBuilder builder) =>
 builder
 .AddCreator <ProblemDetails, ProblemDetailsJsonContractCreator>()
 .AddCreator <ValidationProblemDetails, ValidationProblemDetailsJsonContractCreator>();
コード例 #5
0
 public static IMicroContractResolverBuilder AddMiddlewareFactory <T> (this IMicroContractResolverBuilder builder)
     where T : class, IJsonMiddlewareFactory, new() =>
 builder.AddMiddlewareFactory(Singleton <T> .instance);
コード例 #6
0
 public static IMicroContractResolverBuilder AddPatch <T> (this IMicroContractResolverBuilder builder)
     where T : class, IJsonContractPatch, new() =>
 builder.AddPatch(Singleton <T> .instance);
コード例 #7
0
 public static IMicroContractResolverBuilder AddCreator <TData, T> (this IMicroContractResolverBuilder builder)
     where T : class, IJsonContractCreator, new() =>
 builder.AddCreator(typeof(TData), Singleton <T> .instance);