public static void RegisterStandardFacetFactories(IServiceCollection services) { var factoryTypes = FacetFactories.StandardFacetFactories(); for (var i = 0; i < factoryTypes.Length; i++) { ConfigHelpers.RegisterFacetFactory(factoryTypes[i], services, i); } }
public static void RegisterStandardFacetFactories(IUnityContainer container) { var factoryTypes = FacetFactories.StandardFacetFactories(); for (int i = 0; i < factoryTypes.Count(); i++) { UnityConfigHelpers.RegisterFacetFactory(factoryTypes[i], container, i); } }
protected static void RegisterFacetFactories(IUnityContainer container) { var factoryTypes = FacetFactories.StandardFacetFactories(); for (int i = 0; i < factoryTypes.Length; i++) { RegisterFacetFactory(factoryTypes[i], container, i); } }
protected override IReflector Reflector(Metamodel metamodel, ILoggerFactory lf) { var config = new CoreConfiguration(); ClassStrategy = new SystemTypeClassStrategy(config); var systemTypeFacetFactorySet = new SystemTypeFacetFactorySet(FacetFactories.OfType <IObjectFacetFactoryProcessor>()); var mockLogger1 = new Mock <ILogger <AbstractParallelReflector> >().Object; return(new SystemTypeReflector(systemTypeFacetFactorySet, (SystemTypeClassStrategy)ClassStrategy, metamodel, config, new IFacetDecorator[] { }, lf, mockLogger1)); }
public static void RegisterReplacementFacetFactory <TReplacement, TOriginal>(IUnityContainer container) where TReplacement : IFacetFactory where TOriginal : IFacetFactory { int order = FacetFactories.StandardIndexOf(typeof(TOriginal)); container.RegisterType <IFacetFactory, TReplacement>( typeof(TOriginal).Name, new ContainerControlledLifetimeManager(), new InjectionConstructor(order)); }
//Helper method to, subsistute a new implementation of a specific facet factory, but where the constructor // of the new one takes: a numeric order, and the standard NOF implementation of that facet factory. public static void RegisterReplacementFacetFactoryDelegatingToOriginal <TReplacement, TOriginal>(IUnityContainer container) where TReplacement : IFacetFactory where TOriginal : IFacetFactory { int order = FacetFactories.StandardIndexOf(typeof(TOriginal)); //Register the orginal (standard NOF implementation). Note that although already registered by StandardUnityConfig.RegisterStandardFacetFactories //that will be as a named impl of IFacetFactory. This will be the only one registered as the concrete type //PropertyMethodsFacetFactory so doesn't need to be named. container.RegisterType <TOriginal>( new ContainerControlledLifetimeManager(), new InjectionConstructor(0)); //We don't care about the order, because this isn't called as a FacetFactory AS SUCH. //but we still need one for the constructor // Now add replacement using the standard pattern but using the same Name and orderNumber as the one being superseded. // The original one will be auto-injected into it because of the implementation registered above container.RegisterType <IFacetFactory, TReplacement>( typeof(TOriginal).Name, //Following standard pattern for all NOF factories new ContainerControlledLifetimeManager(), new InjectionConstructor(order, typeof(TOriginal))); }
internal static LoaderFacetFactory GetFactoryInfo(int databaseId) { return(FacetFactories.Where(x => x.DatabaseId == databaseId).SingleOrDefault()); }
internal static LoaderFacetFactory GetFactoryInfo(TypeMoniker factoryType) { return(FacetFactories.Where(x => x.Type == factoryType).Single()); }
internal static LoaderFacetFactory GetFactoryInfo(IFacetFactory factory) { return(FacetFactories.Where(x => x.Factory == factory).Single()); }
private static int GetExistingOrder <TOriginal>() { var order = FacetFactories.StandardIndexOf(typeof(TOriginal)); return(order == -1 ? ParallelReflect.FacetFactories.StandardIndexOf(typeof(TOriginal)) : order); }