Where is the Data Access Layer in NopCommerce v1.9 ?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 years ago
Where is the Data Access Layer in NopCommerce v1.9 ?

All i see is business logic project, i am trying to understand how the data is actually being inserted and selected. Where are the queries?
11 years ago
V 1.9 uses entity frameworks

look in say Product Manager

/// <summary>
        /// Gets product
        /// </summary>
        /// <param name="productId">Product identifier</param>
        /// <returns>Product</returns>
        public static Product GetProductById(int productId)
        {
            if (productId == 0)
                return null;

            string key = string.Format(PRODUCTS_BY_ID_KEY, productId);
            object obj2 = NopRequestCache.Get(key);
            if (ProductManager.CacheEnabled && (obj2 != null))
            {
                return (Product)obj2;
            }

            var context = ObjectContextHelper.CurrentObjectContext;
            var query = from p in context.Products
                        where p.ProductId == productId
                        select p;
            var product = query.SingleOrDefault();

            if (ProductManager.CacheEnabled)
            {
                NopRequestCache.Add(key, product);
            }
            return product;
        }


EF writes the queries from the linq you provide.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.