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>();
public static IMicroContractResolverBuilder AddFactory <T> (this IMicroContractResolverBuilder builder) where T : class, IJsonContractFactory, new() => builder.AddFactory(Singleton <T> .instance);