Ejemplo n.º 1
0
        //Cosntructor
        public RepositorioManager(
            IRepositorio <Usuarios> repositorioUser,
            IRepositorio <Empleado> repositorioEmployee,
            IRepositorio <Cliente> repositorioClient,
            IRepositorio <Direccion> repositorioAddress,
            IRepositorio <Telefono> repositorioPhone,
            IRepositorio <Empresa> repositorioCompany,
            IRepositorio <Producto> repositorioProduct,
            IRepositorio <Ingrediente> repositorioIngredient,
            IRepositorio <Pedido> repositorioOrder,
            IRepositorio <DetallesPedido> repositorioOrderDetails,
            IRepositorio <IngredientesProducto> repositorioProductIngredient)
        {
            _context = repositorioUser.ContextoDB <PizzonEntities>();

            _user              = repositorioUser;
            _employee          = repositorioEmployee;
            _client            = repositorioClient;
            _address           = repositorioAddress;
            _phone             = repositorioPhone;
            _company           = repositorioCompany;
            _product           = repositorioProduct;
            _ingredient        = repositorioIngredient;
            _order             = repositorioOrder;
            _orderDetails      = repositorioOrderDetails;
            _productIngredient = repositorioProductIngredient;
        }
Ejemplo n.º 2
0
        public override void Load()
        {
            //API modulos
            Bind <IUsersAPI>().To <UsersAPI>();
            Bind <IEmployeesAPI>().To <EmployeesAPI>();
            Bind <IProductsAPI>().To <ProductsAPI>();
            Bind <IIngredientsAPI>().To <IngredientsAPI>();

            //Inyeccion al constructor del repositorio general
            Bind <IRepositorioManager>().ToMethod(
                c =>
            {
                var context = new PizzonEntities();
                return(new RepositorioManager(
                           new Repositorio <Usuarios>(context),
                           new Repositorio <Empleado>(context),
                           new Repositorio <Cliente>(context),
                           new Repositorio <Direccion>(context),
                           new Repositorio <Telefono>(context),
                           new Repositorio <Empresa>(context),
                           new Repositorio <Producto>(context),
                           new Repositorio <Ingrediente>(context),
                           new Repositorio <Pedido>(context),
                           new Repositorio <DetallesPedido>(context),
                           new Repositorio <IngredientesProducto>(context)
                           ));
            });
        }