/// <summary> /// Composes the Navigation Property tree sent to the Database class /// </summary> /// <returns> /// List of NavPropertyInfo /// </returns> internal static List <NavPropertyInfo> BuildNavPropInfos(NavProps navprops) { if (!(navprops?.Count > 0)) { return(null); } var result = new List <NavPropertyInfo>(navprops.Count); foreach (var p in navprops) { var np = (InvoiceNavProperty)p.Value; var npInfo = _navPropInfos[np]; result.Add(npInfo); if (!(p.NavProps?.Count > 0)) { continue; } switch (np) { case InvoiceNavProperty.Customer: npInfo.NavProps = TheSharpFactory.Repository.MainDb.People.CustomerRepository.BuildNavPropInfos(p.NavProps); break; case InvoiceNavProperty.InvoiceLines: npInfo.NavProps = TheSharpFactory.Repository.MainDb.Accounting.InvoiceLineRepository.BuildNavPropInfos(p.NavProps); break; default: throw new ArgumentException($"NavigationProperty {np} is not valid."); } } return(result); }
/// <summary> /// Composes the Navigation Property tree sent to the Database class /// </summary> /// <returns> /// List of NavPropertyInfo /// </returns> internal static List <NavPropertyInfo> BuildNavPropInfos(NavProps navprops) { if (!(navprops?.Count > 0)) { return(null); } var result = new List <NavPropertyInfo>(navprops.Count); foreach (var p in navprops) { var np = (AlbumNavProperty)p.Value; var npInfo = _navPropInfos[np]; result.Add(npInfo); if (!(p.NavProps?.Count > 0)) { continue; } switch (np) { case AlbumNavProperty.Artist: npInfo.NavProps = TheSharpFactory.Repository.MainDb.Media.ArtistRepository.BuildNavPropInfos(p.NavProps); break; case AlbumNavProperty.Tracks: npInfo.NavProps = TheSharpFactory.Repository.MainDb.Media.TrackRepository.BuildNavPropInfos(p.NavProps); break; default: throw new ArgumentException($"NavigationProperty {np} is not valid."); } } return(result); }
/// <summary> /// Composes the Navigation Property tree sent to the Database class /// </summary> /// <returns> /// List of NavPropertyInfo /// </returns> internal static List <NavPropertyInfo> BuildNavPropInfos(NavProps navprops) { if (!(navprops?.Count > 0)) { return(null); } var result = new List <NavPropertyInfo>(navprops.Count); foreach (var p in navprops) { var np = (ColorNavProperty)p.Value; var npInfo = _navPropInfos[np]; result.Add(npInfo); if (!(p.NavProps?.Count > 0)) { continue; } switch (np) { case ColorNavProperty.Person: npInfo.NavProps = TheSharpFactory.Data.Repository.WorldWideImporters.Application.PersonRepository.BuildNavPropInfos(p.NavProps); break; case ColorNavProperty.StockItems: npInfo.NavProps = TheSharpFactory.Data.Repository.WorldWideImporters.Warehouse.StockItemRepository.BuildNavPropInfos(p.NavProps); break; default: throw new ArgumentException($"NavigationProperty {np} is not valid."); } } return(result); }
/// <summary> /// Gets the specified TheSharpFactory.Data.Entity.WorldWideImporters.Application.City from the database by Primary Key. Supports navigation properties. /// </summary> /// <param name="cityid">Primary Key Field.</param> /// <param name="navprops">The navigation properties to include in the result.</param> /// <returns>Single TheSharpFactory.Data.Entity.WorldWideImporters.Application.City</returns> public City ByPK(int cityid, NavProps <CityNavProperty> navprops) { var where = new QueryFilters <CityProperty>(1) { QueryFilter.New(CityProperty.CityID, FilterConditions.Equals, cityid), }; return(SelectSingle(where, DefaultSort, navprops)); }
/// <summary> /// Gets the specified TheSharpFactory.Data.Entity.WorldWideImporters.Warehouse.StockItem from the database by Primary Key. Supports navigation properties. /// </summary> /// <param name="stockitemid">Primary Key Field.</param> /// <param name="navprops">The navigation properties to include in the result.</param> /// <returns>Single TheSharpFactory.Data.Entity.WorldWideImporters.Warehouse.StockItem</returns> public StockItem ByPK(int stockitemid, NavProps <StockItemNavProperty> navprops) { var where = new QueryFilters <StockItemProperty>(1) { QueryFilter.New(StockItemProperty.StockItemID, FilterConditions.Equals, stockitemid), }; return(SelectSingle(where, DefaultSort, navprops)); }
/// <summary> /// Gets the specified TheSharpFactory.Data.Entity.WorldWideImporters.Warehouse.Color from the database by Primary Key. Supports navigation properties. /// </summary> /// <param name="colorid">Primary Key Field.</param> /// <param name="navprops">The navigation properties to include in the result.</param> /// <returns>Single TheSharpFactory.Data.Entity.WorldWideImporters.Warehouse.Color</returns> public Color ByPK(int colorid, NavProps <ColorNavProperty> navprops) { var where = new QueryFilters <ColorProperty>(1) { QueryFilter.New(ColorProperty.ColorID, FilterConditions.Equals, colorid), }; return(SelectSingle(where, DefaultSort, navprops)); }
/// <summary> /// Gets the specified TheSharpFactory.Entity.MainDb.Media.MediaType from the database by Primary Key. Supports navigation properties. /// </summary> /// <param name="mediatypeid">Primary Key Field.</param> /// <param name="navprops">The navigation properties to include in the result.</param> /// <returns>Single TheSharpFactory.Entity.MainDb.Media.MediaType</returns> public MediaType ByPK(int mediatypeid, NavProps <MediaTypeNavProperty> navprops) { var where = new QueryFilters <MediaTypeProperty>(1) { QueryFilter.New(MediaTypeProperty.MediaTypeId, FilterConditions.Equals, mediatypeid), }; return(SelectSingle(where, DefaultSort, navprops)); }
/// <summary> /// Gets the specified TheSharpFactory.Data.Entity.WorldWideImporters.Purchasing.PurchaseOrder from the database by Primary Key. Supports navigation properties. /// </summary> /// <param name="purchaseorderid">Primary Key Field.</param> /// <param name="navprops">The navigation properties to include in the result.</param> /// <returns>Single TheSharpFactory.Data.Entity.WorldWideImporters.Purchasing.PurchaseOrder</returns> public PurchaseOrder ByPK(int purchaseorderid, NavProps <PurchaseOrderNavProperty> navprops) { var where = new QueryFilters <PurchaseOrderProperty>(1) { QueryFilter.New(PurchaseOrderProperty.PurchaseOrderID, FilterConditions.Equals, purchaseorderid), }; return(SelectSingle(where, DefaultSort, navprops)); }
/// <summary> /// Gets the specified TheSharpFactory.Data.Entity.WorldWideImporters.Application.PaymentMethod from the database by Primary Key. Supports navigation properties. /// </summary> /// <param name="paymentmethodid">Primary Key Field.</param> /// <param name="navprops">The navigation properties to include in the result.</param> /// <returns>Single TheSharpFactory.Data.Entity.WorldWideImporters.Application.PaymentMethod</returns> public PaymentMethod ByPK(int paymentmethodid, NavProps <PaymentMethodNavProperty> navprops) { var where = new QueryFilters <PaymentMethodProperty>(1) { QueryFilter.New(PaymentMethodProperty.PaymentMethodID, FilterConditions.Equals, paymentmethodid), }; return(SelectSingle(where, DefaultSort, navprops)); }
/// <summary> /// Gets the specified TheSharpFactory.Data.Entity.WorldWideImporters.Application.SystemParameter from the database by Primary Key. Supports navigation properties. /// </summary> /// <param name="systemparameterid">Primary Key Field.</param> /// <param name="navprops">The navigation properties to include in the result.</param> /// <returns>Single TheSharpFactory.Data.Entity.WorldWideImporters.Application.SystemParameter</returns> public SystemParameter ByPK(int systemparameterid, NavProps <SystemParameterNavProperty> navprops) { var where = new QueryFilters <SystemParameterProperty>(1) { QueryFilter.New(SystemParameterProperty.SystemParameterID, FilterConditions.Equals, systemparameterid), }; return(SelectSingle(where, DefaultSort, navprops)); }
/// <summary> /// Gets the specified TheSharpFactory.Data.Entity.WorldWideImporters.Sales.CustomerCategory from the database by Primary Key. Supports navigation properties. /// </summary> /// <param name="customercategoryid">Primary Key Field.</param> /// <param name="navprops">The navigation properties to include in the result.</param> /// <returns>Single TheSharpFactory.Data.Entity.WorldWideImporters.Sales.CustomerCategory</returns> public CustomerCategory ByPK(int customercategoryid, NavProps <CustomerCategoryNavProperty> navprops) { var where = new QueryFilters <CustomerCategoryProperty>(1) { QueryFilter.New(CustomerCategoryProperty.CustomerCategoryID, FilterConditions.Equals, customercategoryid), }; return(SelectSingle(where, DefaultSort, navprops)); }
/// <summary> /// Gets the specified TheSharpFactory.Data.Entity.WorldWideImporters.Sales.SpecialDeal from the database by Primary Key. Supports navigation properties. /// </summary> /// <param name="specialdealid">Primary Key Field.</param> /// <param name="navprops">The navigation properties to include in the result.</param> /// <returns>Single TheSharpFactory.Data.Entity.WorldWideImporters.Sales.SpecialDeal</returns> public SpecialDeal ByPK(int specialdealid, NavProps <SpecialDealNavProperty> navprops) { var where = new QueryFilters <SpecialDealProperty>(1) { QueryFilter.New(SpecialDealProperty.SpecialDealID, FilterConditions.Equals, specialdealid), }; return(SelectSingle(where, DefaultSort, navprops)); }
/// <summary> /// Gets the specified TheSharpFactory.Data.Entity.WorldWideImporters.Application.TransactionType from the database by Primary Key. Supports navigation properties. /// </summary> /// <param name="transactiontypeid">Primary Key Field.</param> /// <param name="navprops">The navigation properties to include in the result.</param> /// <returns>Single TheSharpFactory.Data.Entity.WorldWideImporters.Application.TransactionType</returns> public TransactionType ByPK(int transactiontypeid, NavProps <TransactionTypeNavProperty> navprops) { var where = new QueryFilters <TransactionTypeProperty>(1) { QueryFilter.New(TransactionTypeProperty.TransactionTypeID, FilterConditions.Equals, transactiontypeid), }; return(SelectSingle(where, DefaultSort, navprops)); }
/// <summary> /// Gets the specified TheSharpFactory.Data.Entity.WorldWideImporters.Application.StateProvince from the database by Primary Key. Supports navigation properties. /// </summary> /// <param name="stateprovinceid">Primary Key Field.</param> /// <param name="navprops">The navigation properties to include in the result.</param> /// <returns>Single TheSharpFactory.Data.Entity.WorldWideImporters.Application.StateProvince</returns> public StateProvince ByPK(int stateprovinceid, NavProps <StateProvinceNavProperty> navprops) { var where = new QueryFilters <StateProvinceProperty>(1) { QueryFilter.New(StateProvinceProperty.StateProvinceID, FilterConditions.Equals, stateprovinceid), }; return(SelectSingle(where, DefaultSort, navprops)); }
/// <summary> /// Gets the specified TheSharpFactory.Data.Entity.WorldWideImporters.Warehouse.PackageType from the database by Primary Key. Supports navigation properties. /// </summary> /// <param name="packagetypeid">Primary Key Field.</param> /// <param name="navprops">The navigation properties to include in the result.</param> /// <returns>Single TheSharpFactory.Data.Entity.WorldWideImporters.Warehouse.PackageType</returns> public PackageType ByPK(int packagetypeid, NavProps <PackageTypeNavProperty> navprops) { var where = new QueryFilters <PackageTypeProperty>(1) { QueryFilter.New(PackageTypeProperty.PackageTypeID, FilterConditions.Equals, packagetypeid), }; return(SelectSingle(where, DefaultSort, navprops)); }
/// <summary> /// Gets the specified TheSharpFactory.Entity.MainDb.Media.PlaylistTrack from the database by Primary Key. Supports navigation properties. /// </summary> /// <param name="playlistid">Primary Key Field.</param> /// <param name="trackid">Primary Key Field.</param> /// <param name="navprops">The navigation properties to include in the result.</param> /// <returns>Single TheSharpFactory.Entity.MainDb.Media.PlaylistTrack</returns> public PlaylistTrack ByPK(int playlistid, int trackid, NavProps <PlaylistTrackNavProperty> navprops) { var where = new QueryFilters <PlaylistTrackProperty>(2) { QueryFilter.New(PlaylistTrackProperty.PlaylistId, FilterConditions.Equals, playlistid), QueryFilter.New(PlaylistTrackProperty.TrackId, FilterConditions.Equals, trackid), }; return(SelectSingle(where, DefaultSort, navprops)); }
/// <summary> /// Gets the specified TheSharpFactory.Entity.MainDb.Media.Album from the database by Primary Key. Supports navigation properties. /// </summary> /// <param name="albumid">Primary Key Field.</param> /// <param name="navprops">The navigation properties to include in the result.</param> /// <returns>Single TheSharpFactory.Entity.MainDb.Media.Album</returns> public Album ByPK(int albumid, NavProps <AlbumNavProperty> navprops) { var where = new QueryFilters <AlbumProperty>(1) { QueryFilter.New(AlbumProperty.AlbumId, FilterConditions.Equals, albumid), }; return(SelectSingle(where, DefaultSort, navprops)); }
/// <summary> /// Gets the specified TheSharpFactory.Entity.MainDb.Media.Artist from the database by Primary Key. Supports navigation properties. /// </summary> /// <param name="artistid">Primary Key Field.</param> /// <param name="navprops">The navigation properties to include in the result.</param> /// <returns>Single TheSharpFactory.Entity.MainDb.Media.Artist</returns> public Artist ByPK(int artistid, NavProps <ArtistNavProperty> navprops) { var where = new QueryFilters <ArtistProperty>(1) { QueryFilter.New(ArtistProperty.ArtistId, FilterConditions.Equals, artistid), }; return(SelectSingle(where, DefaultSort, navprops)); }
/// <summary> /// Gets the specified TheSharpFactory.Data.Entity.WorldWideImporters.Application.DeliveryMethod from the database by Primary Key. Supports navigation properties. /// </summary> /// <param name="deliverymethodid">Primary Key Field.</param> /// <param name="navprops">The navigation properties to include in the result.</param> /// <returns>Single TheSharpFactory.Data.Entity.WorldWideImporters.Application.DeliveryMethod</returns> public DeliveryMethod ByPK(int deliverymethodid, NavProps <DeliveryMethodNavProperty> navprops) { var where = new QueryFilters <DeliveryMethodProperty>(1) { QueryFilter.New(DeliveryMethodProperty.DeliveryMethodID, FilterConditions.Equals, deliverymethodid), }; return(SelectSingle(where, DefaultSort, navprops)); }
/// <summary> /// Gets the specified TheSharpFactory.Data.Entity.WorldWideImporters.Sales.OrderLine from the database by Primary Key. Supports navigation properties. /// </summary> /// <param name="orderlineid">Primary Key Field.</param> /// <param name="navprops">The navigation properties to include in the result.</param> /// <returns>Single TheSharpFactory.Data.Entity.WorldWideImporters.Sales.OrderLine</returns> public OrderLine ByPK(int orderlineid, NavProps <OrderLineNavProperty> navprops) { var where = new QueryFilters <OrderLineProperty>(1) { QueryFilter.New(OrderLineProperty.OrderLineID, FilterConditions.Equals, orderlineid), }; return(SelectSingle(where, DefaultSort, navprops)); }
/// <summary> /// Gets the specified TheSharpFactory.Entity.MainDb.Media.Genre from the database by Primary Key. Supports navigation properties. /// </summary> /// <param name="genreid">Primary Key Field.</param> /// <param name="navprops">The navigation properties to include in the result.</param> /// <returns>Single TheSharpFactory.Entity.MainDb.Media.Genre</returns> public Genre ByPK(int genreid, NavProps <GenreNavProperty> navprops) { var where = new QueryFilters <GenreProperty>(1) { QueryFilter.New(GenreProperty.GenreId, FilterConditions.Equals, genreid), }; return(SelectSingle(where, DefaultSort, navprops)); }
/// <summary> /// Gets the specified TheSharpFactory.Data.Entity.WorldWideImporters.Sales.BuyingGroup from the database by Primary Key. Supports navigation properties. /// </summary> /// <param name="buyinggroupid">Primary Key Field.</param> /// <param name="navprops">The navigation properties to include in the result.</param> /// <returns>Single TheSharpFactory.Data.Entity.WorldWideImporters.Sales.BuyingGroup</returns> public BuyingGroup ByPK(int buyinggroupid, NavProps <BuyingGroupNavProperty> navprops) { var where = new QueryFilters <BuyingGroupProperty>(1) { QueryFilter.New(BuyingGroupProperty.BuyingGroupID, FilterConditions.Equals, buyinggroupid), }; return(SelectSingle(where, DefaultSort, navprops)); }
/// <summary> /// Gets the specified TheSharpFactory.Data.Entity.WorldWideImporters.Purchasing.SupplierTransaction from the database by Primary Key. Supports navigation properties. /// </summary> /// <param name="suppliertransactionid">Primary Key Field.</param> /// <param name="navprops">The navigation properties to include in the result.</param> /// <returns>Single TheSharpFactory.Data.Entity.WorldWideImporters.Purchasing.SupplierTransaction</returns> public SupplierTransaction ByPK(int suppliertransactionid, NavProps <SupplierTransactionNavProperty> navprops) { var where = new QueryFilters <SupplierTransactionProperty>(1) { QueryFilter.New(SupplierTransactionProperty.SupplierTransactionID, FilterConditions.Equals, suppliertransactionid), }; return(SelectSingle(where, DefaultSort, navprops)); }
/// <summary> /// Gets the specified TheSharpFactory.Entity.MainDb.Media.Track from the database by Primary Key. Supports navigation properties. /// </summary> /// <param name="trackid">Primary Key Field.</param> /// <param name="navprops">The navigation properties to include in the result.</param> /// <returns>Single TheSharpFactory.Entity.MainDb.Media.Track</returns> public Track ByPK(int trackid, NavProps <TrackNavProperty> navprops) { var where = new QueryFilters <TrackProperty>(1) { QueryFilter.New(TrackProperty.TrackId, FilterConditions.Equals, trackid), }; return(SelectSingle(where, DefaultSort, navprops)); }
/// <summary> /// Gets the specified TheSharpFactory.Entity.MainDb.People.Employee from the database by Primary Key. Supports navigation properties. /// </summary> /// <param name="employeeid">Primary Key Field.</param> /// <param name="navprops">The navigation properties to include in the result.</param> /// <returns>Single TheSharpFactory.Entity.MainDb.People.Employee</returns> public Employee ByPK(int employeeid, NavProps <EmployeeNavProperty> navprops) { var where = new QueryFilters <EmployeeProperty>(1) { QueryFilter.New(EmployeeProperty.EmployeeId, FilterConditions.Equals, employeeid), }; return(SelectSingle(where, DefaultSort, navprops)); }
/// <summary> /// Gets the specified TheSharpFactory.Entity.MainDb.Accounting.Invoice from the database by Primary Key. Supports navigation properties. /// </summary> /// <param name="invoiceid">Primary Key Field.</param> /// <param name="navprops">The navigation properties to include in the result.</param> /// <returns>Single TheSharpFactory.Entity.MainDb.Accounting.Invoice</returns> public Invoice ByPK(int invoiceid, NavProps <InvoiceNavProperty> navprops) { var where = new QueryFilters <InvoiceProperty>(1) { QueryFilter.New(InvoiceProperty.InvoiceId, FilterConditions.Equals, invoiceid), }; return(SelectSingle(where, DefaultSort, navprops)); }
/// <summary> /// Gets the specified TheSharpFactory.Data.Entity.WorldWideImporters.Warehouse.StockItem from the database by Unique Key named UQ_Warehouse_StockItems_StockItemName. Supports navigation properties. /// </summary> /// <param name="stockitemname">Unique Key Field.</param> /// <param name="navprops">The navigation properties to include in the result.</param> /// <returns>Single TheSharpFactory.Data.Entity.WorldWideImporters.Warehouse.StockItem</returns> public StockItem ByUK(string stockitemname, NavProps <StockItemNavProperty> navprops) { //this method uses the UniqueKey UQ_Warehouse_StockItems_StockItemName var where = new QueryFilters <StockItemProperty>(1) { QueryFilter.New(StockItemProperty.StockItemName, FilterConditions.Equals, stockitemname), }; return(SelectSingle(where, _sortBy_UQ_Warehouse_StockItems_StockItemName, navprops)); }
/// <summary> /// Gets the specified TheSharpFactory.Data.Entity.WorldWideImporters.Application.DeliveryMethod from the database by Unique Key named UQ_Application_DeliveryMethods_DeliveryMethodName. Supports navigation properties. /// </summary> /// <param name="deliverymethodname">Unique Key Field.</param> /// <param name="navprops">The navigation properties to include in the result.</param> /// <returns>Single TheSharpFactory.Data.Entity.WorldWideImporters.Application.DeliveryMethod</returns> public DeliveryMethod ByUK(string deliverymethodname, NavProps <DeliveryMethodNavProperty> navprops) { //this method uses the UniqueKey UQ_Application_DeliveryMethods_DeliveryMethodName var where = new QueryFilters <DeliveryMethodProperty>(1) { QueryFilter.New(DeliveryMethodProperty.DeliveryMethodName, FilterConditions.Equals, deliverymethodname), }; return(SelectSingle(where, _sortBy_UQ_Application_DeliveryMethods_DeliveryMethodName, navprops)); }
/// <summary> /// Gets the specified TheSharpFactory.Data.Entity.WorldWideImporters.Sales.BuyingGroup from the database by Unique Key named UQ_Sales_BuyingGroups_BuyingGroupName. Supports navigation properties. /// </summary> /// <param name="buyinggroupname">Unique Key Field.</param> /// <param name="navprops">The navigation properties to include in the result.</param> /// <returns>Single TheSharpFactory.Data.Entity.WorldWideImporters.Sales.BuyingGroup</returns> public BuyingGroup ByUK(string buyinggroupname, NavProps <BuyingGroupNavProperty> navprops) { //this method uses the UniqueKey UQ_Sales_BuyingGroups_BuyingGroupName var where = new QueryFilters <BuyingGroupProperty>(1) { QueryFilter.New(BuyingGroupProperty.BuyingGroupName, FilterConditions.Equals, buyinggroupname), }; return(SelectSingle(where, _sortBy_UQ_Sales_BuyingGroups_BuyingGroupName, navprops)); }
/// <summary> /// Gets the specified TheSharpFactory.Data.Entity.WorldWideImporters.Warehouse.Color from the database by Unique Key named UQ_Warehouse_Colors_ColorName. Supports navigation properties. /// </summary> /// <param name="colorname">Unique Key Field.</param> /// <param name="navprops">The navigation properties to include in the result.</param> /// <returns>Single TheSharpFactory.Data.Entity.WorldWideImporters.Warehouse.Color</returns> public Color ByUK(string colorname, NavProps <ColorNavProperty> navprops) { //this method uses the UniqueKey UQ_Warehouse_Colors_ColorName var where = new QueryFilters <ColorProperty>(1) { QueryFilter.New(ColorProperty.ColorName, FilterConditions.Equals, colorname), }; return(SelectSingle(where, _sortBy_UQ_Warehouse_Colors_ColorName, navprops)); }