예제 #1
0
 // This method gets called by the runtime. Use this method to add services to the container.
 public void ConfigureServices(IServiceCollection services)
 {
     /*   Rest client = Rest.Instanse(services);
      * CoreState.Rest = client;*/
     CoreState.AddContextWithSwagger(services, "http://172.17.9.105:1600/api", "qrpay", "joha", "123456789$j");
     services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
 }
예제 #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public IServiceProvider ConfigureServices(IServiceCollection services)
        {
            CoreState.AddContextWithSwagger(services, "http://172.17.9.105:1600/api", "postman", "postman", "postman");

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
            ContainerBuilder builder = new ContainerBuilder();

            services.AddCors();
            Assembly assembly = typeof(IRepositoryCore <,>).Assembly;

            //builder.RegisterGeneric(typeof(IRepositoryCore<,>), assembly);
            Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
            // Assembly[] assemblies = GetYourAssemblies();
            builder.RegisterGeneric(typeof(LiteRepository.Repository.LiteRepository <>))
            .As(typeof(IRepositoryCore <,>))
            .InstancePerLifetimeScope();
            var lite = new LiteDbContext();

            builder.RegisterInstance(lite).As <ILiteContext>();
            Service.Start.Builder(builder);
            builder.Populate(services);
            Container = builder.Build();
            return(new AutofacServiceProvider(Container));
        }