public static TrainDTrainorV2.Core.Data.Entities.RefreshToken GetByKey(this System.Linq.IQueryable <TrainDTrainorV2.Core.Data.Entities.RefreshToken> queryable, Guid id)
        {
            var dbSet = queryable as DbSet <TrainDTrainorV2.Core.Data.Entities.RefreshToken>;

            if (dbSet != null)
            {
                return(dbSet.Find(id));
            }
            return(queryable.FirstOrDefault(r => r.Id == id));
        }
Beispiel #2
0
        /// <summary>
        /// Gets an instance by the primary key.
        /// </summary>
        public static AdventureWorks.Data.Entities.ScrapReason GetByKey(this System.Linq.IQueryable <AdventureWorks.Data.Entities.ScrapReason> queryable, short scrapReasonID)
        {
            var dbSet = queryable as System.Data.Entity.IDbSet <AdventureWorks.Data.Entities.ScrapReason>;

            if (dbSet != null)
            {
                return(dbSet.Find(scrapReasonID));
            }

            return(queryable.FirstOrDefault(s => s.ScrapReasonID == scrapReasonID));
        }
Beispiel #3
0
        /// <summary>
        /// Gets an instance by the primary key.
        /// </summary>
        public static Petshop.Data.Entities.Profile GetByKey(this System.Linq.IQueryable <Petshop.Data.Entities.Profile> queryable, string userId)
        {
            var dbSet = queryable as System.Data.Entity.IDbSet <Petshop.Data.Entities.Profile>;

            if (dbSet != null)
            {
                return(dbSet.Find(userId));
            }

            return(queryable.FirstOrDefault(p => p.UserId == userId));
        }
Beispiel #4
0
        /// <summary>
        /// Gets an instance by the primary key.
        /// </summary>
        public static AdventureWorks.Data.Entities.ProductSubcategory GetByKey(this System.Linq.IQueryable <AdventureWorks.Data.Entities.ProductSubcategory> queryable, int productSubcategoryID)
        {
            var dbSet = queryable as System.Data.Entity.IDbSet <AdventureWorks.Data.Entities.ProductSubcategory>;

            if (dbSet != null)
            {
                return(dbSet.Find(productSubcategoryID));
            }

            return(queryable.FirstOrDefault(p => p.ProductSubcategoryID == productSubcategoryID));
        }
Beispiel #5
0
        /// <summary>
        /// Gets an instance by the primary key.
        /// </summary>
        public static AdventureWorks.Data.Entities.SalesTerritory GetByKey(this System.Linq.IQueryable <AdventureWorks.Data.Entities.SalesTerritory> queryable, int territoryID)
        {
            var dbSet = queryable as System.Data.Entity.IDbSet <AdventureWorks.Data.Entities.SalesTerritory>;

            if (dbSet != null)
            {
                return(dbSet.Find(territoryID));
            }

            return(queryable.FirstOrDefault(s => s.TerritoryID == territoryID));
        }
Beispiel #6
0
        /// <summary>
        /// Gets an instance by the primary key.
        /// </summary>
        public static AdventureWorks.Data.Entities.Contact GetByKey(this System.Linq.IQueryable <AdventureWorks.Data.Entities.Contact> queryable, int contactID)
        {
            var dbSet = queryable as System.Data.Entity.IDbSet <AdventureWorks.Data.Entities.Contact>;

            if (dbSet != null)
            {
                return(dbSet.Find(contactID));
            }

            return(queryable.FirstOrDefault(c => c.ContactID == contactID));
        }
        /// <summary>
        /// Gets an instance by the primary key.
        /// </summary>
        public static AdventureWorks.Data.Entities.SalesTaxRate GetByKey(this System.Linq.IQueryable <AdventureWorks.Data.Entities.SalesTaxRate> queryable, int salesTaxRateID)
        {
            var dbSet = queryable as System.Data.Entity.IDbSet <AdventureWorks.Data.Entities.SalesTaxRate>;

            if (dbSet != null)
            {
                return(dbSet.Find(salesTaxRateID));
            }

            return(queryable.FirstOrDefault(s => s.SalesTaxRateID == salesTaxRateID));
        }
Beispiel #8
0
        /// <summary>
        /// Gets an instance by the primary key.
        /// </summary>
        public static AdventureWorks.Data.Entities.TransactionHistoryArchive GetByKey(this System.Linq.IQueryable <AdventureWorks.Data.Entities.TransactionHistoryArchive> queryable, int transactionID)
        {
            var dbSet = queryable as System.Data.Entity.IDbSet <AdventureWorks.Data.Entities.TransactionHistoryArchive>;

            if (dbSet != null)
            {
                return(dbSet.Find(transactionID));
            }

            return(queryable.FirstOrDefault(t => t.TransactionID == transactionID));
        }
Beispiel #9
0
        /// <summary>
        /// Gets an instance by the primary key.
        /// </summary>
        public static AdventureWorks.Data.Entities.Location GetByKey(this System.Linq.IQueryable <AdventureWorks.Data.Entities.Location> queryable, short locationID)
        {
            var dbSet = queryable as System.Data.Entity.IDbSet <AdventureWorks.Data.Entities.Location>;

            if (dbSet != null)
            {
                return(dbSet.Find(locationID));
            }

            return(queryable.FirstOrDefault(l => l.LocationID == locationID));
        }
Beispiel #10
0
        public static TrainDTrainorV2.Core.Data.Entities.LevelVideo GetByKey(this System.Linq.IQueryable <TrainDTrainorV2.Core.Data.Entities.LevelVideo> queryable, Guid id)
        {
            var dbSet = queryable as DbSet <TrainDTrainorV2.Core.Data.Entities.LevelVideo>;

            if (dbSet != null)
            {
                return(dbSet.Find(id));
            }

            return(queryable.FirstOrDefault(i => i.Id == id));
        }
        /// <summary>
        /// Gets an instance by the primary key.
        /// </summary>
        public static AdventureWorks.Data.Entities.Individual GetByKey(this System.Linq.IQueryable <AdventureWorks.Data.Entities.Individual> queryable, int customerID)
        {
            var dbSet = queryable as System.Data.Entity.IDbSet <AdventureWorks.Data.Entities.Individual>;

            if (dbSet != null)
            {
                return(dbSet.Find(customerID));
            }

            return(queryable.FirstOrDefault(i => i.CustomerID == customerID));
        }
        /// <summary>
        /// Gets an instance by the primary key.
        /// </summary>
        public static AdventureWorks.Data.Entities.AWBuildVersion GetByKey(this System.Linq.IQueryable <AdventureWorks.Data.Entities.AWBuildVersion> queryable, byte systemInformationID)
        {
            var dbSet = queryable as System.Data.Entity.IDbSet <AdventureWorks.Data.Entities.AWBuildVersion>;

            if (dbSet != null)
            {
                return(dbSet.Find(systemInformationID));
            }

            return(queryable.FirstOrDefault(a => a.SystemInformationID == systemInformationID));
        }
        /// <summary>
        /// Gets an instance by the primary key.
        /// </summary>
        public static Petshop.Data.Entities.BannerData GetByKey(this System.Linq.IQueryable <Petshop.Data.Entities.BannerData> queryable, string favCategory)
        {
            var dbSet = queryable as System.Data.Entity.IDbSet <Petshop.Data.Entities.BannerData>;

            if (dbSet != null)
            {
                return(dbSet.Find(favCategory));
            }

            return(queryable.FirstOrDefault(b => b.FavCategory == favCategory));
        }
        /// <summary>
        /// Gets an instance by the primary key.
        /// </summary>
        public static AdventureWorks.Data.Entities.JobCandidate GetByKey(this System.Linq.IQueryable <AdventureWorks.Data.Entities.JobCandidate> queryable, int jobCandidateID)
        {
            var dbSet = queryable as System.Data.Entity.IDbSet <AdventureWorks.Data.Entities.JobCandidate>;

            if (dbSet != null)
            {
                return(dbSet.Find(jobCandidateID));
            }

            return(queryable.FirstOrDefault(j => j.JobCandidateID == jobCandidateID));
        }
        /// <summary>
        /// Gets an instance by the primary key.
        /// </summary>
        public static Petshop.Data.Entities.Category GetByKey(this System.Linq.IQueryable <Petshop.Data.Entities.Category> queryable, string catId)
        {
            var dbSet = queryable as System.Data.Entity.IDbSet <Petshop.Data.Entities.Category>;

            if (dbSet != null)
            {
                return(dbSet.Find(catId));
            }

            return(queryable.FirstOrDefault(c => c.CatId == catId));
        }
        /// <summary>
        /// Gets an instance by the primary key.
        /// </summary>
        public static Petshop.Data.Entities.Orders GetByKey(this System.Linq.IQueryable <Petshop.Data.Entities.Orders> queryable, int orderId)
        {
            var dbSet = queryable as System.Data.Entity.IDbSet <Petshop.Data.Entities.Orders>;

            if (dbSet != null)
            {
                return(dbSet.Find(orderId));
            }

            return(queryable.FirstOrDefault(o => o.OrderId == orderId));
        }
Beispiel #17
0
        /// <summary>
        /// Gets an instance by the primary key.
        /// </summary>
        public static AdventureWorks.Data.Entities.ErrorLog GetByKey(this System.Linq.IQueryable <AdventureWorks.Data.Entities.ErrorLog> queryable, int errorLogID)
        {
            var dbSet = queryable as System.Data.Entity.IDbSet <AdventureWorks.Data.Entities.ErrorLog>;

            if (dbSet != null)
            {
                return(dbSet.Find(errorLogID));
            }

            return(queryable.FirstOrDefault(e => e.ErrorLogID == errorLogID));
        }
        /// <summary>
        /// Gets an instance by the primary key.
        /// </summary>
        public static AdventureWorks.Data.Entities.Address GetByKey(this System.Linq.IQueryable <AdventureWorks.Data.Entities.Address> queryable, int addressID)
        {
            var dbSet = queryable as System.Data.Entity.IDbSet <AdventureWorks.Data.Entities.Address>;

            if (dbSet != null)
            {
                return(dbSet.Find(addressID));
            }

            return(queryable.FirstOrDefault(a => a.AddressID == addressID));
        }
        /// <summary>
        /// Gets an instance by the primary key.
        /// </summary>
        public static AdventureWorks.Data.Entities.UnitMeasure GetByKey(this System.Linq.IQueryable <AdventureWorks.Data.Entities.UnitMeasure> queryable, string unitMeasureCode)
        {
            var dbSet = queryable as System.Data.Entity.IDbSet <AdventureWorks.Data.Entities.UnitMeasure>;

            if (dbSet != null)
            {
                return(dbSet.Find(unitMeasureCode));
            }

            return(queryable.FirstOrDefault(u => u.UnitMeasureCode == unitMeasureCode));
        }
Beispiel #20
0
        /// <summary>
        /// Gets an instance by the primary key.
        /// </summary>
        public static AdventureWorks.Data.Entities.Shift GetByKey(this System.Linq.IQueryable <AdventureWorks.Data.Entities.Shift> queryable, byte shiftID)
        {
            var dbSet = queryable as System.Data.Entity.IDbSet <AdventureWorks.Data.Entities.Shift>;

            if (dbSet != null)
            {
                return(dbSet.Find(shiftID));
            }

            return(queryable.FirstOrDefault(s => s.ShiftID == shiftID));
        }
        public static TrainDTrainorV2.Core.Data.Entities.TrainingBuildCourseAttendee GetByKey(this System.Linq.IQueryable <TrainDTrainorV2.Core.Data.Entities.TrainingBuildCourseAttendee> queryable, Guid id)
        {
            var dbSet = queryable as DbSet <TrainDTrainorV2.Core.Data.Entities.TrainingBuildCourseAttendee>;

            if (dbSet != null)
            {
                return(dbSet.Find(id));
            }

            return(queryable.FirstOrDefault(i => i.Id == id));
        }
Beispiel #22
0
        /// <summary>
        /// Gets an instance by the primary key.
        /// </summary>
        public static AdventureWorks.Data.Entities.Currency GetByKey(this System.Linq.IQueryable <AdventureWorks.Data.Entities.Currency> queryable, string currencyCode)
        {
            var dbSet = queryable as System.Data.Entity.IDbSet <AdventureWorks.Data.Entities.Currency>;

            if (dbSet != null)
            {
                return(dbSet.Find(currencyCode));
            }

            return(queryable.FirstOrDefault(c => c.CurrencyCode == currencyCode));
        }
        /// <summary>
        /// Gets an instance by the primary key.
        /// </summary>
        public static Petshop.Data.Entities.SignOn GetByKey(this System.Linq.IQueryable <Petshop.Data.Entities.SignOn> queryable, string userName)
        {
            var dbSet = queryable as System.Data.Entity.IDbSet <Petshop.Data.Entities.SignOn>;

            if (dbSet != null)
            {
                return(dbSet.Find(userName));
            }

            return(queryable.FirstOrDefault(s => s.UserName == userName));
        }
        /// <summary>
        /// Gets an instance by the primary key.
        /// </summary>
        public static Petshop.Data.Entities.Product GetByKey(this System.Linq.IQueryable <Petshop.Data.Entities.Product> queryable, string productId)
        {
            var dbSet = queryable as System.Data.Entity.IDbSet <Petshop.Data.Entities.Product>;

            if (dbSet != null)
            {
                return(dbSet.Find(productId));
            }

            return(queryable.FirstOrDefault(p => p.ProductId == productId));
        }
        public static TrainDTrainorV2.Core.Data.Entities.EmailDelivery GetByKey(this System.Linq.IQueryable <TrainDTrainorV2.Core.Data.Entities.EmailDelivery> queryable, Guid id)
        {
            var dbSet = queryable as DbSet <TrainDTrainorV2.Core.Data.Entities.EmailDelivery>;

            if (dbSet != null)
            {
                return(dbSet.Find(id));
            }

            return(queryable.FirstOrDefault(e => e.Id == id));
        }
        /// <summary>
        /// Gets an instance by the primary key.
        /// </summary>
        public static Petshop.Data.Entities.Item GetByKey(this System.Linq.IQueryable <Petshop.Data.Entities.Item> queryable, string itemId)
        {
            var dbSet = queryable as System.Data.Entity.IDbSet <Petshop.Data.Entities.Item>;

            if (dbSet != null)
            {
                return(dbSet.Find(itemId));
            }

            return(queryable.FirstOrDefault(i => i.ItemId == itemId));
        }
Beispiel #27
0
        /// <summary>
        /// Gets an instance by the primary key.
        /// </summary>
        public static AdventureWorks.Data.Entities.SpecialOffer GetByKey(this System.Linq.IQueryable <AdventureWorks.Data.Entities.SpecialOffer> queryable, int specialOfferID)
        {
            var dbSet = queryable as System.Data.Entity.IDbSet <AdventureWorks.Data.Entities.SpecialOffer>;

            if (dbSet != null)
            {
                return(dbSet.Find(specialOfferID));
            }

            return(queryable.FirstOrDefault(s => s.SpecialOfferID == specialOfferID));
        }
Beispiel #28
0
        /// <summary>
        /// Gets an instance by the primary key.
        /// </summary>
        public static AdventureWorks.Data.Entities.ShoppingCartItem GetByKey(this System.Linq.IQueryable <AdventureWorks.Data.Entities.ShoppingCartItem> queryable, int shoppingCartItemID)
        {
            var dbSet = queryable as System.Data.Entity.IDbSet <AdventureWorks.Data.Entities.ShoppingCartItem>;

            if (dbSet != null)
            {
                return(dbSet.Find(shoppingCartItemID));
            }

            return(queryable.FirstOrDefault(s => s.ShoppingCartItemID == shoppingCartItemID));
        }
Beispiel #29
0
        /// <summary>
        /// Gets an instance by the primary key.
        /// </summary>
        public static AdventureWorks.Data.Entities.Illustration GetByKey(this System.Linq.IQueryable <AdventureWorks.Data.Entities.Illustration> queryable, int illustrationID)
        {
            var dbSet = queryable as System.Data.Entity.IDbSet <AdventureWorks.Data.Entities.Illustration>;

            if (dbSet != null)
            {
                return(dbSet.Find(illustrationID));
            }

            return(queryable.FirstOrDefault(i => i.IllustrationID == illustrationID));
        }
        /// <summary>
        /// Gets an instance by the primary key.
        /// </summary>
        public static AdventureWorks.Data.Entities.Department GetByKey(this System.Linq.IQueryable <AdventureWorks.Data.Entities.Department> queryable, short departmentID)
        {
            var dbSet = queryable as System.Data.Entity.IDbSet <AdventureWorks.Data.Entities.Department>;

            if (dbSet != null)
            {
                return(dbSet.Find(departmentID));
            }

            return(queryable.FirstOrDefault(d => d.DepartmentID == departmentID));
        }