public override void PreInit(IIocManager instance) { if (!instance.IsRegister(typeof(IRepository <>))) { instance.RegisterGeneric(typeof(DosOrmRepositoryBase <>), typeof(IRepository <>)); } instance.RegisterGeneric(typeof(DosOrmRepositoryBase <>), typeof(IDosOrmRepository <>)); base.PreInit(instance); }
public void register_asm_can_resolve_IDistributionFacility_T() { ioc.RegisterAssemblyAsInterfaces(asm); ioc.RegisterGeneric(typeof(MsmqDistribution <>), typeof(IDistributionFacility <>)); var mq = ioc.Resolve <IDistributionFacility <MessageEntity> >(); Assert.IsNotNull(mq); }
public override void PreInit(IIocManager instance) { instance.RegisterGeneric(typeof(MyServiceGeneric <>), typeof(IServiceGeneric <>)); instance.RegisterType(typeof(MyServiceGeneric2), typeof(IServiceGeneric2 <int>)); instance.RegisterGeneric(typeof(MyObjectProvider <>), typeof(IObjectProvider <>)); instance.RegisterGeneric(typeof(RepositoryA <,>), typeof(IRepository <,>), "RepositoryA"); instance.RegisterGeneric(typeof(RepositoryB <,>), typeof(IRepository <,>), "RepositoryB"); instance.RegisterTypeAsObject(false, Assembly.GetExecutingAssembly().GetTypes().Where(c => typeof(MyDbObject).IsAssignableFrom(c)).ToArray()); instance.RegisterAssemblies(Assembly.GetExecutingAssembly()); base.PreInit(instance); }
public static void RegisterRepository(this IIocManager instance, Type type, Type interRepositoryType, string name) { if (type.IsGenericType) { Type interfaceType = type.GetInterfaces().FirstOrDefault(item => item.GetInterfaces().Any(c => c.GUID == typeof(IRepository <,>).GUID) && item.GUID != typeof(IRepository <,>).GUID); if (interfaceType.IsNotNull()) { instance.RegisterGeneric(type, interfaceType, name); } instance.RegisterGeneric(type, interRepositoryType, name); } else { instance.RegisterTypes(type); } }
public override void PreInit(IIocManager instance) { instance.RegisterGeneric(typeof(DbContextProvider <>), typeof(IDbContextProvider <>), interceptor: false); instance.RegisterType <EfUnitOfWork, IUnitOfWork>(interceptor: false); base.PreInit(instance); }