コード例 #1
0
        /// <summary>
        /// Gets all store.
        /// </summary>
        /// <returns>Get All Store</returns>
        public List <Store> GetAllStore()
        {
            using (IllusionSalesDBEntities entites = new IllusionSalesDBEntities())
            {
                //returns entities from the conceptual model
                ObjectQuery <Store> stores = entites.Stores;

                //objects are maintained in a detached state and are not tracked in the ObjectStateManager;
                stores.MergeOption = MergeOption.NoTracking;

                //queries against a specific data source where in the type of the data is known
                IQueryable <Store> query = from store in stores select store;

                //Materialized result
                List <Store> result = query.ToList();
                return(result);
            }
        }
コード例 #2
0
        /// <summary>
        /// Gets all customer.
        /// </summary>
        /// <returns>Get All Customer</returns>
        public List <Customer> GetAllCustomer()
        {
            using (IllusionSalesDBEntities entities = new IllusionSalesDBEntities())
            {
                //returns entities from conceptual model
                ObjectQuery <Customer> customers = entities.Customers;

                //objects are maintained in a detached state and are not tracked in the ObjectStateManager;
                customers.MergeOption = MergeOption.NoTracking;

                //queries against a specific data source where in the type of the data is known
                IQueryable <Customer> query = from cust in customers select cust;

                //Materialized result
                List <Customer> customerList = query.ToList();
                return(customerList);
            }
        }
コード例 #3
0
        /// <summary>
        /// Gets the country region.
        /// </summary>
        /// <returns>Get Country Region</returns>
        public List <Country> GetCountryRegion()
        {
            using (IllusionSalesDBEntities entities = new IllusionSalesDBEntities())
            {
                //returns Country entities from the conceptual model
                ObjectQuery <Country> regions = entities.Countries;

                //objects are maintained in a detached state and are not tracked in the ObjectStateManager;
                regions.MergeOption = MergeOption.NoTracking;

                //queries against a specific data source where in the type of the data is known
                IQueryable <Country> query = from region in regions select region;

                //Materialized Country result
                List <Country> result = query.ToList();
                return(result);
            }
        }