/// <summary> /// Creates a factory that implements any property-only interface using backing fields with optional notification before and after sets. /// </summary> /// <typeparam name="TBase"></typeparam> /// <param name="propertyChangingHandlerName"></param> /// <param name="propertyChangedHandlerName"></param> /// <returns></returns> public static AdaptiveFactory <TBase> CreateDtoFactory <TBase>(string propertyChangingHandlerName, string propertyChangedHandlerName) where TBase : class { AdaptiveFactory <TBase> factory = new AdaptiveFactory <TBase>(); factory.ImplementProperties().UsingBackingField().WithSetInspector(propertyChangingHandlerName, propertyChangedHandlerName); return(factory); }
/// <summary> /// Creates a factory that can create proxies around any interface. /// </summary> /// <typeparam name="TBase"></typeparam> /// <param name="targetMemberName">Name of field/property/method on TBase that yields inner instance to forward all calls to.</param> /// <returns></returns> public static AdaptiveFactory <TBase> CreateProxyFactory <TBase>(string targetMemberName) where TBase : class { AdaptiveFactory <TBase> factory = new AdaptiveFactory <TBase>(); factory.ImplementSecondaryByMethods = true; factory.ImplementMethods().UsingTarget(targetMemberName); return(factory); }