├── DAL8 ├── obj │ ├── Debug │ │ └── net8.0 │ │ │ ├── DAL8.csproj.BuildWithSkipAnalyzers │ │ │ ├── DAL8.dll │ │ │ ├── DAL8.pdb │ │ │ ├── DAL8.AssemblyInfoInputs.cache │ │ │ ├── DAL8.genruntimeconfig.cache │ │ │ ├── ref │ │ │ └── DAL8.dll │ │ │ ├── DAL8.csproj.CoreCompileInputs.cache │ │ │ ├── refint │ │ │ └── DAL8.dll │ │ │ ├── DAL8.assets.cache │ │ │ ├── DAL8.csproj.AssemblyReference.cache │ │ │ ├── DAL8.GlobalUsings.g.cs │ │ │ ├── DAL8.GeneratedMSBuildEditorConfig.editorconfig │ │ │ ├── DAL8.AssemblyInfo.cs │ │ │ └── DAL8.csproj.FileListAbsolute.txt │ ├── Release │ │ └── net8.0 │ │ │ ├── DAL8.csproj.BuildWithSkipAnalyzers │ │ │ ├── DAL8.dll │ │ │ ├── DAL8.pdb │ │ │ ├── DAL8.AssemblyInfoInputs.cache │ │ │ ├── DAL8.genruntimeconfig.cache │ │ │ ├── ref │ │ │ └── DAL8.dll │ │ │ ├── DAL8.csproj.CoreCompileInputs.cache │ │ │ ├── refint │ │ │ └── DAL8.dll │ │ │ ├── DAL8.assets.cache │ │ │ ├── DAL8.csproj.AssemblyReference.cache │ │ │ ├── DAL8.GlobalUsings.g.cs │ │ │ ├── DAL8.GeneratedMSBuildEditorConfig.editorconfig │ │ │ ├── DAL8.AssemblyInfo.cs │ │ │ └── DAL8.csproj.FileListAbsolute.txt │ ├── DAL8.csproj.nuget.g.targets │ ├── DAL8.csproj.EntityFrameworkCore.targets │ ├── DAL8.csproj.nuget.g.props │ ├── DAL8.csproj.nuget.dgspec.json │ └── project.nuget.cache ├── Models │ └── DB │ │ ├── OrderSubtotal.cs │ │ ├── CurrentProductList.cs │ │ ├── CategorySalesFor1997.cs │ │ ├── ProductsAboveAveragePrice.cs │ │ ├── SummaryOfSalesByYear.cs │ │ ├── SummaryOfSalesByQuarter.cs │ │ ├── ProductSalesFor1997.cs │ │ ├── Region.cs │ │ ├── QuarterlyOrder.cs │ │ ├── CustomerDemographic.cs │ │ ├── SalesByCategory.cs │ │ ├── SalesTotalsByAmount.cs │ │ ├── Shipper.cs │ │ ├── CustomerAndSuppliersByCity.cs │ │ ├── Role.cs │ │ ├── UserRole.cs │ │ ├── ProductsByCategory.cs │ │ ├── Action.cs │ │ ├── Category.cs │ │ ├── RoleGroup.cs │ │ ├── Module.cs │ │ ├── Territory.cs │ │ ├── VwCustomerProduct.cs │ │ ├── UserAction.cs │ │ ├── OrderDetail.cs │ │ ├── OrderDetailsExtended.cs │ │ ├── AlphabeticalListOfProduct.cs │ │ ├── User.cs │ │ ├── Supplier.cs │ │ ├── Product.cs │ │ ├── Customer.cs │ │ ├── Order.cs │ │ ├── OrdersQry.cs │ │ ├── Employee.cs │ │ ├── Invoice.cs │ │ └── NorthwindContext.cs ├── Class1.cs └── DAL8.csproj ├── Models ├── Enums.cs ├── GlobalTypes.cs ├── CodPlayers.cs └── Products.cs ├── Net8Features.http ├── WeatherServiceOptions.cs ├── appsettings.Development.json ├── Net8Features.csproj.user ├── appsettings.json ├── IWeatherService.cs ├── WeatherForecast.cs ├── Interception.cs ├── Net8Features.csproj ├── Properties └── launchSettings.json ├── Program.cs ├── Net8Features.sln ├── Controllers ├── WeatherTestController.cs └── WeatherForecastController.cs ├── WeatherService.cs └── WeatherService2.cs /DAL8/obj/Debug/net8.0/DAL8.csproj.BuildWithSkipAnalyzers: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /DAL8/obj/Release/net8.0/DAL8.csproj.BuildWithSkipAnalyzers: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /DAL8/obj/Debug/net8.0/DAL8.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/borakasmer/Net8Day/HEAD/DAL8/obj/Debug/net8.0/DAL8.dll -------------------------------------------------------------------------------- /DAL8/obj/Debug/net8.0/DAL8.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/borakasmer/Net8Day/HEAD/DAL8/obj/Debug/net8.0/DAL8.pdb -------------------------------------------------------------------------------- /DAL8/obj/Release/net8.0/DAL8.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/borakasmer/Net8Day/HEAD/DAL8/obj/Release/net8.0/DAL8.dll -------------------------------------------------------------------------------- /DAL8/obj/Release/net8.0/DAL8.pdb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/borakasmer/Net8Day/HEAD/DAL8/obj/Release/net8.0/DAL8.pdb -------------------------------------------------------------------------------- /DAL8/obj/Debug/net8.0/DAL8.AssemblyInfoInputs.cache: -------------------------------------------------------------------------------- 1 | 637385e0825f4ffcf3717faf4c39efda1af58b598b1c4120aac92ad538636733 2 | -------------------------------------------------------------------------------- /DAL8/obj/Debug/net8.0/DAL8.genruntimeconfig.cache: -------------------------------------------------------------------------------- 1 | 648196e4f781b2405a380fc1f8f7e80479b6cc1b12ee2bb99e14830c2ae65ad6 2 | -------------------------------------------------------------------------------- /DAL8/obj/Debug/net8.0/ref/DAL8.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/borakasmer/Net8Day/HEAD/DAL8/obj/Debug/net8.0/ref/DAL8.dll -------------------------------------------------------------------------------- /DAL8/obj/Release/net8.0/DAL8.AssemblyInfoInputs.cache: -------------------------------------------------------------------------------- 1 | b42a628417dfbd9269800c2a387b15cbea59ac866f68beacadc548708f4a5661 2 | -------------------------------------------------------------------------------- /DAL8/obj/Release/net8.0/DAL8.genruntimeconfig.cache: -------------------------------------------------------------------------------- 1 | 5236562335050d59dfcb49d6d14201f064079cc565100be328a221f53f3aff18 2 | -------------------------------------------------------------------------------- /DAL8/obj/Debug/net8.0/DAL8.csproj.CoreCompileInputs.cache: -------------------------------------------------------------------------------- 1 | ae468a5b647c8b948f18ad270f497e3f0c8ef5630fcb80a56896051284833df1 2 | -------------------------------------------------------------------------------- /DAL8/obj/Debug/net8.0/refint/DAL8.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/borakasmer/Net8Day/HEAD/DAL8/obj/Debug/net8.0/refint/DAL8.dll -------------------------------------------------------------------------------- /DAL8/obj/Release/net8.0/ref/DAL8.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/borakasmer/Net8Day/HEAD/DAL8/obj/Release/net8.0/ref/DAL8.dll -------------------------------------------------------------------------------- /DAL8/obj/Debug/net8.0/DAL8.assets.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/borakasmer/Net8Day/HEAD/DAL8/obj/Debug/net8.0/DAL8.assets.cache -------------------------------------------------------------------------------- /DAL8/obj/Release/net8.0/DAL8.csproj.CoreCompileInputs.cache: -------------------------------------------------------------------------------- 1 | e0bf6843d8060d37f15c79eb8a10fffbf3fe12870113486e6f44495f7dfa6468 2 | -------------------------------------------------------------------------------- /DAL8/obj/Release/net8.0/refint/DAL8.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/borakasmer/Net8Day/HEAD/DAL8/obj/Release/net8.0/refint/DAL8.dll -------------------------------------------------------------------------------- /DAL8/obj/Release/net8.0/DAL8.assets.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/borakasmer/Net8Day/HEAD/DAL8/obj/Release/net8.0/DAL8.assets.cache -------------------------------------------------------------------------------- /DAL8/obj/Debug/net8.0/DAL8.csproj.AssemblyReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/borakasmer/Net8Day/HEAD/DAL8/obj/Debug/net8.0/DAL8.csproj.AssemblyReference.cache -------------------------------------------------------------------------------- /DAL8/obj/Release/net8.0/DAL8.csproj.AssemblyReference.cache: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/borakasmer/Net8Day/HEAD/DAL8/obj/Release/net8.0/DAL8.csproj.AssemblyReference.cache -------------------------------------------------------------------------------- /Models/Enums.cs: -------------------------------------------------------------------------------- 1 | namespace Net8Features.Models 2 | { 3 | public enum ServiceType 4 | { 5 | weather = 1, 6 | weather2 = 2, 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Net8Features.http: -------------------------------------------------------------------------------- 1 | @Net8Features_HostAddress = http://localhost:5248 2 | 3 | GET {{Net8Features_HostAddress}}/weatherforecast/ 4 | Accept: application/json 5 | 6 | ### 7 | -------------------------------------------------------------------------------- /WeatherServiceOptions.cs: -------------------------------------------------------------------------------- 1 | namespace Net8Features 2 | { 3 | public class WeatherServiceOptions 4 | { 5 | public string ServiceName { get; set; } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Models/GlobalTypes.cs: -------------------------------------------------------------------------------- 1 | 2 | global using ShoppingData = 3 | ( 4 | Net8Features.Models.ServiceType Type, 5 | System.Collections.Frozen.FrozenDictionary Basket 6 | ); 7 | -------------------------------------------------------------------------------- /Net8Features.csproj.user: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | https 5 | 6 | -------------------------------------------------------------------------------- /DAL8/Models/DB/OrderSubtotal.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DAL8.Models.DB; 5 | 6 | public partial class OrderSubtotal 7 | { 8 | public int OrderId { get; set; } 9 | 10 | public decimal? Subtotal { get; set; } 11 | } 12 | -------------------------------------------------------------------------------- /appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "WeatherServiceOptions": { 9 | "ServiceName": "weather" 10 | }, 11 | "AllowedHosts": "*" 12 | } 13 | -------------------------------------------------------------------------------- /DAL8/Models/DB/CurrentProductList.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DAL8.Models.DB; 5 | 6 | public partial class CurrentProductList 7 | { 8 | public int ProductId { get; set; } 9 | 10 | public string ProductName { get; set; } = null!; 11 | } 12 | -------------------------------------------------------------------------------- /DAL8/Models/DB/CategorySalesFor1997.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DAL8.Models.DB; 5 | 6 | public partial class CategorySalesFor1997 7 | { 8 | public string CategoryName { get; set; } = null!; 9 | 10 | public decimal? CategorySales { get; set; } 11 | } 12 | -------------------------------------------------------------------------------- /IWeatherService.cs: -------------------------------------------------------------------------------- 1 | using Net8Features.Models; 2 | 3 | namespace Net8Features 4 | { 5 | public interface IWeatherService 6 | { 7 | public void GetMyName(); 8 | public void GetMyName(string name); 9 | public Task> GetAllCodPlayers(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /DAL8/Models/DB/ProductsAboveAveragePrice.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DAL8.Models.DB; 5 | 6 | public partial class ProductsAboveAveragePrice 7 | { 8 | public string ProductName { get; set; } = null!; 9 | 10 | public decimal? UnitPrice { get; set; } 11 | } 12 | -------------------------------------------------------------------------------- /DAL8/Models/DB/SummaryOfSalesByYear.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DAL8.Models.DB; 5 | 6 | public partial class SummaryOfSalesByYear 7 | { 8 | public DateTime? ShippedDate { get; set; } 9 | 10 | public int OrderId { get; set; } 11 | 12 | public decimal? Subtotal { get; set; } 13 | } 14 | -------------------------------------------------------------------------------- /DAL8/obj/Debug/net8.0/DAL8.GlobalUsings.g.cs: -------------------------------------------------------------------------------- 1 | // 2 | global using global::System; 3 | global using global::System.Collections.Generic; 4 | global using global::System.IO; 5 | global using global::System.Linq; 6 | global using global::System.Net.Http; 7 | global using global::System.Threading; 8 | global using global::System.Threading.Tasks; 9 | -------------------------------------------------------------------------------- /DAL8/obj/Release/net8.0/DAL8.GlobalUsings.g.cs: -------------------------------------------------------------------------------- 1 | // 2 | global using global::System; 3 | global using global::System.Collections.Generic; 4 | global using global::System.IO; 5 | global using global::System.Linq; 6 | global using global::System.Net.Http; 7 | global using global::System.Threading; 8 | global using global::System.Threading.Tasks; 9 | -------------------------------------------------------------------------------- /DAL8/Models/DB/SummaryOfSalesByQuarter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DAL8.Models.DB; 5 | 6 | public partial class SummaryOfSalesByQuarter 7 | { 8 | public DateTime? ShippedDate { get; set; } 9 | 10 | public int OrderId { get; set; } 11 | 12 | public decimal? Subtotal { get; set; } 13 | } 14 | -------------------------------------------------------------------------------- /WeatherForecast.cs: -------------------------------------------------------------------------------- 1 | namespace Net8Features 2 | { 3 | public class WeatherForecast 4 | { 5 | public DateOnly Date { get; set; } 6 | 7 | public int TemperatureC { get; set; } 8 | 9 | public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); 10 | 11 | public string? Summary { get; set; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /DAL8/Models/DB/ProductSalesFor1997.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DAL8.Models.DB; 5 | 6 | public partial class ProductSalesFor1997 7 | { 8 | public string CategoryName { get; set; } = null!; 9 | 10 | public string ProductName { get; set; } = null!; 11 | 12 | public decimal? ProductSales { get; set; } 13 | } 14 | -------------------------------------------------------------------------------- /DAL8/Models/DB/Region.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DAL8.Models.DB; 5 | 6 | public partial class Region 7 | { 8 | public int RegionId { get; set; } 9 | 10 | public string RegionDescription { get; set; } = null!; 11 | 12 | public virtual ICollection Territories { get; set; } = new List(); 13 | } 14 | -------------------------------------------------------------------------------- /Interception.cs: -------------------------------------------------------------------------------- 1 | using Net8Features.Controllers; 2 | using System.Runtime.CompilerServices; 3 | 4 | //[AttributeUsage(AttributeTargets.Method, AllowMultiple = true, Inherited = false)] 5 | //public sealed class InterceptsLocationAttribute : Attribute 6 | //{ 7 | // public InterceptsLocationAttribute(string filePath, int line, int character) 8 | // { 9 | 10 | // } 11 | //} -------------------------------------------------------------------------------- /DAL8/Models/DB/QuarterlyOrder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DAL8.Models.DB; 5 | 6 | public partial class QuarterlyOrder 7 | { 8 | public string? CustomerId { get; set; } 9 | 10 | public string? CompanyName { get; set; } 11 | 12 | public string? City { get; set; } 13 | 14 | public string? Country { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /DAL8/Models/DB/CustomerDemographic.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DAL8.Models.DB; 5 | 6 | public partial class CustomerDemographic 7 | { 8 | public string CustomerTypeId { get; set; } = null!; 9 | 10 | public string? CustomerDesc { get; set; } 11 | 12 | public virtual ICollection Customers { get; set; } = new List(); 13 | } 14 | -------------------------------------------------------------------------------- /DAL8/Models/DB/SalesByCategory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DAL8.Models.DB; 5 | 6 | public partial class SalesByCategory 7 | { 8 | public int CategoryId { get; set; } 9 | 10 | public string CategoryName { get; set; } = null!; 11 | 12 | public string ProductName { get; set; } = null!; 13 | 14 | public decimal? ProductSales { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /DAL8/Models/DB/SalesTotalsByAmount.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DAL8.Models.DB; 5 | 6 | public partial class SalesTotalsByAmount 7 | { 8 | public decimal? SaleAmount { get; set; } 9 | 10 | public int OrderId { get; set; } 11 | 12 | public string CompanyName { get; set; } = null!; 13 | 14 | public DateTime? ShippedDate { get; set; } 15 | } 16 | -------------------------------------------------------------------------------- /DAL8/Models/DB/Shipper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DAL8.Models.DB; 5 | 6 | public partial class Shipper 7 | { 8 | public int ShipperId { get; set; } 9 | 10 | public string CompanyName { get; set; } = null!; 11 | 12 | public string? Phone { get; set; } 13 | 14 | public virtual ICollection Orders { get; set; } = new List(); 15 | } 16 | -------------------------------------------------------------------------------- /DAL8/Models/DB/CustomerAndSuppliersByCity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DAL8.Models.DB; 5 | 6 | public partial class CustomerAndSuppliersByCity 7 | { 8 | public string? City { get; set; } 9 | 10 | public string CompanyName { get; set; } = null!; 11 | 12 | public string? ContactName { get; set; } 13 | 14 | public string Relationship { get; set; } = null!; 15 | } 16 | -------------------------------------------------------------------------------- /DAL8/Models/DB/Role.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DAL8.Models.DB; 5 | 6 | public partial class Role 7 | { 8 | public int Id { get; set; } 9 | 10 | public long? RoleId { get; set; } 11 | 12 | public string? RoleName { get; set; } 13 | 14 | public int? GroupId { get; set; } 15 | 16 | public bool? IsDeleted { get; set; } 17 | 18 | public virtual RoleGroup? Group { get; set; } 19 | } 20 | -------------------------------------------------------------------------------- /DAL8/Models/DB/UserRole.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DAL8.Models.DB; 5 | 6 | public partial class UserRole 7 | { 8 | public int Id { get; set; } 9 | 10 | public int? UserId { get; set; } 11 | 12 | public int? RoleGroupId { get; set; } 13 | 14 | public long? Roles { get; set; } 15 | 16 | public virtual RoleGroup? RoleGroup { get; set; } 17 | 18 | public virtual User? User { get; set; } 19 | } 20 | -------------------------------------------------------------------------------- /DAL8/Models/DB/ProductsByCategory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DAL8.Models.DB; 5 | 6 | public partial class ProductsByCategory 7 | { 8 | public string CategoryName { get; set; } = null!; 9 | 10 | public string ProductName { get; set; } = null!; 11 | 12 | public string? QuantityPerUnit { get; set; } 13 | 14 | public short? UnitsInStock { get; set; } 15 | 16 | public bool Discontinued { get; set; } 17 | } 18 | -------------------------------------------------------------------------------- /DAL8/Models/DB/Action.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DAL8.Models.DB; 5 | 6 | public partial class Action 7 | { 8 | public int Id { get; set; } 9 | 10 | public long? ActionNumber { get; set; } 11 | 12 | public string? ActionName { get; set; } 13 | 14 | public int? IdModule { get; set; } 15 | 16 | public bool? IsDeleted { get; set; } 17 | 18 | public virtual Module? IdModuleNavigation { get; set; } 19 | } 20 | -------------------------------------------------------------------------------- /DAL8/Models/DB/Category.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DAL8.Models.DB; 5 | 6 | public partial class Category 7 | { 8 | public int CategoryId { get; set; } 9 | 10 | public string CategoryName { get; set; } = null!; 11 | 12 | public string? Description { get; set; } 13 | 14 | public byte[]? Picture { get; set; } 15 | 16 | public virtual ICollection Products { get; set; } = new List(); 17 | } 18 | -------------------------------------------------------------------------------- /DAL8/Models/DB/RoleGroup.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DAL8.Models.DB; 5 | 6 | public partial class RoleGroup 7 | { 8 | public int Id { get; set; } 9 | 10 | public string? GroupName { get; set; } 11 | 12 | public bool? IsDeleted { get; set; } 13 | 14 | public virtual ICollection Roles { get; set; } = new List(); 15 | 16 | public virtual ICollection UserRoles { get; set; } = new List(); 17 | } 18 | -------------------------------------------------------------------------------- /DAL8/Models/DB/Module.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DAL8.Models.DB; 5 | 6 | public partial class Module 7 | { 8 | public int Id { get; set; } 9 | 10 | public string ModuleName { get; set; } = null!; 11 | 12 | public bool? IsDeleted { get; set; } 13 | 14 | public virtual ICollection Actions { get; set; } = new List(); 15 | 16 | public virtual ICollection UserActions { get; set; } = new List(); 17 | } 18 | -------------------------------------------------------------------------------- /DAL8/Models/DB/Territory.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DAL8.Models.DB; 5 | 6 | public partial class Territory 7 | { 8 | public string TerritoryId { get; set; } = null!; 9 | 10 | public string TerritoryDescription { get; set; } = null!; 11 | 12 | public int RegionId { get; set; } 13 | 14 | public virtual Region Region { get; set; } = null!; 15 | 16 | public virtual ICollection Employees { get; set; } = new List(); 17 | } 18 | -------------------------------------------------------------------------------- /DAL8/Models/DB/VwCustomerProduct.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DAL8.Models.DB; 5 | 6 | public partial class VwCustomerProduct 7 | { 8 | public string CustomerId { get; set; } = null!; 9 | 10 | public string ProductName { get; set; } = null!; 11 | 12 | public string? ShipCountry { get; set; } 13 | 14 | public decimal UnitPrice { get; set; } 15 | 16 | public short Quantity { get; set; } 17 | 18 | public decimal? Total { get; set; } 19 | } 20 | -------------------------------------------------------------------------------- /Models/CodPlayers.cs: -------------------------------------------------------------------------------- 1 | namespace Net8Features.Models 2 | { 3 | public class CodPlayers 4 | { 5 | public string name { get; set; } 6 | public string language { get; set; } 7 | public string id { get; set; } 8 | public string bio { get; set; } 9 | public double version { get; set; } 10 | } 11 | 12 | public class ShortCodPlayers 13 | { 14 | public string name { get; set; } 15 | public double version { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /DAL8/Models/DB/UserAction.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DAL8.Models.DB; 5 | 6 | public partial class UserAction 7 | { 8 | public int Id { get; set; } 9 | 10 | public int? IdUser { get; set; } 11 | 12 | public long? TotalAction { get; set; } 13 | 14 | public int? IdModule { get; set; } 15 | 16 | public bool? IsDeleted { get; set; } 17 | 18 | public virtual Module? IdModuleNavigation { get; set; } 19 | 20 | public virtual User? IdUserNavigation { get; set; } 21 | } 22 | -------------------------------------------------------------------------------- /DAL8/Models/DB/OrderDetail.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DAL8.Models.DB; 5 | 6 | public partial class OrderDetail 7 | { 8 | public int OrderId { get; set; } 9 | 10 | public int ProductId { get; set; } 11 | 12 | public decimal UnitPrice { get; set; } 13 | 14 | public short Quantity { get; set; } 15 | 16 | public float Discount { get; set; } 17 | 18 | public virtual Order Order { get; set; } = null!; 19 | 20 | public virtual Product Product { get; set; } = null!; 21 | } 22 | -------------------------------------------------------------------------------- /DAL8/Models/DB/OrderDetailsExtended.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DAL8.Models.DB; 5 | 6 | public partial class OrderDetailsExtended 7 | { 8 | public int OrderId { get; set; } 9 | 10 | public int ProductId { get; set; } 11 | 12 | public string ProductName { get; set; } = null!; 13 | 14 | public decimal UnitPrice { get; set; } 15 | 16 | public short Quantity { get; set; } 17 | 18 | public float Discount { get; set; } 19 | 20 | public decimal? ExtendedPrice { get; set; } 21 | } 22 | -------------------------------------------------------------------------------- /DAL8/obj/Debug/net8.0/DAL8.GeneratedMSBuildEditorConfig.editorconfig: -------------------------------------------------------------------------------- 1 | is_global = true 2 | build_property.TargetFramework = net8.0 3 | build_property.TargetPlatformMinVersion = 4 | build_property.UsingMicrosoftNETSdkWeb = 5 | build_property.ProjectTypeGuids = 6 | build_property.InvariantGlobalization = 7 | build_property.PlatformNeutralAssembly = 8 | build_property.EnforceExtendedAnalyzerRules = 9 | build_property._SupportedPlatformList = Linux,macOS,Windows 10 | build_property.RootNamespace = DAL8 11 | build_property.ProjectDir = C:\Users\Bora Kasmer\source\repos\GenericAttributeBlog\DAL8\ 12 | build_property.EnableComHosting = 13 | build_property.EnableGeneratedComInterfaceComImportInterop = 14 | -------------------------------------------------------------------------------- /DAL8/obj/Release/net8.0/DAL8.GeneratedMSBuildEditorConfig.editorconfig: -------------------------------------------------------------------------------- 1 | is_global = true 2 | build_property.TargetFramework = net8.0 3 | build_property.TargetPlatformMinVersion = 4 | build_property.UsingMicrosoftNETSdkWeb = 5 | build_property.ProjectTypeGuids = 6 | build_property.InvariantGlobalization = 7 | build_property.PlatformNeutralAssembly = 8 | build_property.EnforceExtendedAnalyzerRules = 9 | build_property._SupportedPlatformList = Linux,macOS,Windows 10 | build_property.RootNamespace = DAL8 11 | build_property.ProjectDir = C:\Users\Bora Kasmer\source\repos\GenericAttributeBlog\DAL8\ 12 | build_property.EnableComHosting = 13 | build_property.EnableGeneratedComInterfaceComImportInterop = 14 | -------------------------------------------------------------------------------- /DAL8/Class1.cs: -------------------------------------------------------------------------------- 1 | namespace DAL8 2 | { 3 | //dotnet add package Microsoft.EntityFrameworkCore.Design; 4 | //dotnet add package Microsoft.EntityFrameworkCore.SqlServer 5 | //dotnet add package Microsoft.EntityFrameworkCore.Tools 6 | 7 | //dotnet ef dbcontext scaffold "Server=.;Database=Northwind; User ID=sa; Password=AspNet55;encrypt=false" Microsoft.EntityFrameworkCore.SqlServer --output-dir Models/DB 8 | 9 | /* 10 | FIX => ADD solution.csproj 11 | 12 | True 13 | false 14 | 15 | */ 16 | public class Class1 17 | { 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Net8Features.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | false 8 | preview 9 | InterceptorsPreview 10 | True 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /DAL8/Models/DB/AlphabeticalListOfProduct.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DAL8.Models.DB; 5 | 6 | public partial class AlphabeticalListOfProduct 7 | { 8 | public int ProductId { get; set; } 9 | 10 | public string ProductName { get; set; } = null!; 11 | 12 | public int? SupplierId { get; set; } 13 | 14 | public int? CategoryId { get; set; } 15 | 16 | public string? QuantityPerUnit { get; set; } 17 | 18 | public decimal? UnitPrice { get; set; } 19 | 20 | public short? UnitsInStock { get; set; } 21 | 22 | public short? UnitsOnOrder { get; set; } 23 | 24 | public short? ReorderLevel { get; set; } 25 | 26 | public bool Discontinued { get; set; } 27 | 28 | public string CategoryName { get; set; } = null!; 29 | } 30 | -------------------------------------------------------------------------------- /DAL8/Models/DB/User.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DAL8.Models.DB; 5 | 6 | public partial class User 7 | { 8 | public int Id { get; set; } 9 | 10 | public string? Name { get; set; } 11 | 12 | public string? LastName { get; set; } 13 | 14 | public string? UserName { get; set; } 15 | 16 | public string? Password { get; set; } 17 | 18 | public string? PasswordHash { get; set; } 19 | 20 | public string? Email { get; set; } 21 | 22 | public string? Gsm { get; set; } 23 | 24 | public bool IsDeleted { get; set; } 25 | 26 | public bool? IsAdmin { get; set; } 27 | 28 | public virtual ICollection UserActions { get; set; } = new List(); 29 | 30 | public virtual ICollection UserRoles { get; set; } = new List(); 31 | } 32 | -------------------------------------------------------------------------------- /DAL8/Models/DB/Supplier.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DAL8.Models.DB; 5 | 6 | public partial class Supplier 7 | { 8 | public int SupplierId { get; set; } 9 | 10 | public string CompanyName { get; set; } = null!; 11 | 12 | public string? ContactName { get; set; } 13 | 14 | public string? ContactTitle { get; set; } 15 | 16 | public string? Address { get; set; } 17 | 18 | public string? City { get; set; } 19 | 20 | public string? Region { get; set; } 21 | 22 | public string? PostalCode { get; set; } 23 | 24 | public string? Country { get; set; } 25 | 26 | public string? Phone { get; set; } 27 | 28 | public string? Fax { get; set; } 29 | 30 | public string? HomePage { get; set; } 31 | 32 | public virtual ICollection Products { get; set; } = new List(); 33 | } 34 | -------------------------------------------------------------------------------- /DAL8/DAL8.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | 8 | 9 | 10 | 11 | all 12 | runtime; build; native; contentfiles; analyzers; buildtransitive 13 | 14 | 15 | 16 | all 17 | runtime; build; native; contentfiles; analyzers; buildtransitive 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /DAL8/Models/DB/Product.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DAL8.Models.DB; 5 | 6 | public partial class Product 7 | { 8 | public int ProductId { get; set; } 9 | 10 | public string ProductName { get; set; } = null!; 11 | 12 | public int? SupplierId { get; set; } 13 | 14 | public int? CategoryId { get; set; } 15 | 16 | public string? QuantityPerUnit { get; set; } 17 | 18 | public decimal? UnitPrice { get; set; } 19 | 20 | public short? UnitsInStock { get; set; } 21 | 22 | public short? UnitsOnOrder { get; set; } 23 | 24 | public short? ReorderLevel { get; set; } 25 | 26 | public bool Discontinued { get; set; } 27 | 28 | public virtual Category? Category { get; set; } 29 | 30 | public virtual ICollection OrderDetails { get; set; } = new List(); 31 | 32 | public virtual Supplier? Supplier { get; set; } 33 | } 34 | -------------------------------------------------------------------------------- /DAL8/Models/DB/Customer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DAL8.Models.DB; 5 | 6 | public partial class Customer 7 | { 8 | public string CustomerId { get; set; } = null!; 9 | 10 | public string CompanyName { get; set; } = null!; 11 | 12 | public string? ContactName { get; set; } 13 | 14 | public string? ContactTitle { get; set; } 15 | 16 | public string? Address { get; set; } 17 | 18 | public string? City { get; set; } 19 | 20 | public string? Region { get; set; } 21 | 22 | public string? PostalCode { get; set; } 23 | 24 | public string? Country { get; set; } 25 | 26 | public string? Phone { get; set; } 27 | 28 | public string? Fax { get; set; } 29 | 30 | public virtual ICollection Orders { get; set; } = new List(); 31 | 32 | public virtual ICollection CustomerTypes { get; set; } = new List(); 33 | } 34 | -------------------------------------------------------------------------------- /DAL8/obj/Debug/net8.0/DAL8.AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | using System; 12 | using System.Reflection; 13 | 14 | [assembly: System.Reflection.AssemblyCompanyAttribute("DAL8")] 15 | [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] 16 | [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] 17 | [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] 18 | [assembly: System.Reflection.AssemblyProductAttribute("DAL8")] 19 | [assembly: System.Reflection.AssemblyTitleAttribute("DAL8")] 20 | [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] 21 | 22 | // Generated by the MSBuild WriteCodeFragment class. 23 | 24 | -------------------------------------------------------------------------------- /DAL8/obj/DAL8.csproj.nuget.g.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DAL8/obj/Release/net8.0/DAL8.AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | using System; 12 | using System.Reflection; 13 | 14 | [assembly: System.Reflection.AssemblyCompanyAttribute("DAL8")] 15 | [assembly: System.Reflection.AssemblyConfigurationAttribute("Release")] 16 | [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] 17 | [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")] 18 | [assembly: System.Reflection.AssemblyProductAttribute("DAL8")] 19 | [assembly: System.Reflection.AssemblyTitleAttribute("DAL8")] 20 | [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] 21 | 22 | // Generated by the MSBuild WriteCodeFragment class. 23 | 24 | -------------------------------------------------------------------------------- /DAL8/Models/DB/Order.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DAL8.Models.DB; 5 | 6 | public partial class Order 7 | { 8 | public int OrderId { get; set; } 9 | 10 | public string? CustomerId { get; set; } 11 | 12 | public int? EmployeeId { get; set; } 13 | 14 | public DateTime? OrderDate { get; set; } 15 | 16 | public DateTime? RequiredDate { get; set; } 17 | 18 | public DateTime? ShippedDate { get; set; } 19 | 20 | public int? ShipVia { get; set; } 21 | 22 | public decimal? Freight { get; set; } 23 | 24 | public string? ShipName { get; set; } 25 | 26 | public string? ShipAddress { get; set; } 27 | 28 | public string? ShipCity { get; set; } 29 | 30 | public string? ShipRegion { get; set; } 31 | 32 | public string? ShipPostalCode { get; set; } 33 | 34 | public string? ShipCountry { get; set; } 35 | 36 | public virtual Customer? Customer { get; set; } 37 | 38 | public virtual Employee? Employee { get; set; } 39 | 40 | public virtual ICollection OrderDetails { get; set; } = new List(); 41 | 42 | public virtual Shipper? ShipViaNavigation { get; set; } 43 | } 44 | -------------------------------------------------------------------------------- /DAL8/Models/DB/OrdersQry.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DAL8.Models.DB; 5 | 6 | public partial class OrdersQry 7 | { 8 | public int OrderId { get; set; } 9 | 10 | public string? CustomerId { get; set; } 11 | 12 | public int? EmployeeId { get; set; } 13 | 14 | public DateTime? OrderDate { get; set; } 15 | 16 | public DateTime? RequiredDate { get; set; } 17 | 18 | public DateTime? ShippedDate { get; set; } 19 | 20 | public int? ShipVia { get; set; } 21 | 22 | public decimal? Freight { get; set; } 23 | 24 | public string? ShipName { get; set; } 25 | 26 | public string? ShipAddress { get; set; } 27 | 28 | public string? ShipCity { get; set; } 29 | 30 | public string? ShipRegion { get; set; } 31 | 32 | public string? ShipPostalCode { get; set; } 33 | 34 | public string? ShipCountry { get; set; } 35 | 36 | public string CompanyName { get; set; } = null!; 37 | 38 | public string? Address { get; set; } 39 | 40 | public string? City { get; set; } 41 | 42 | public string? Region { get; set; } 43 | 44 | public string? PostalCode { get; set; } 45 | 46 | public string? Country { get; set; } 47 | } 48 | -------------------------------------------------------------------------------- /Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "iisSettings": { 4 | "windowsAuthentication": false, 5 | "anonymousAuthentication": true, 6 | "iisExpress": { 7 | "applicationUrl": "http://localhost:28373", 8 | "sslPort": 44397 9 | } 10 | }, 11 | "profiles": { 12 | "http": { 13 | "commandName": "Project", 14 | "dotnetRunMessages": true, 15 | "launchBrowser": true, 16 | "launchUrl": "swagger", 17 | "applicationUrl": "http://localhost:5248", 18 | "environmentVariables": { 19 | "ASPNETCORE_ENVIRONMENT": "Development" 20 | } 21 | }, 22 | "https": { 23 | "commandName": "Project", 24 | "dotnetRunMessages": true, 25 | "launchBrowser": true, 26 | "launchUrl": "swagger", 27 | "applicationUrl": "https://localhost:7183;http://localhost:5248", 28 | "environmentVariables": { 29 | "ASPNETCORE_ENVIRONMENT": "Development" 30 | } 31 | }, 32 | "IIS Express": { 33 | "commandName": "IISExpress", 34 | "launchBrowser": true, 35 | "launchUrl": "swagger", 36 | "environmentVariables": { 37 | "ASPNETCORE_ENVIRONMENT": "Development" 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Models/Products.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | 3 | namespace Net8Features.Models 4 | { 5 | //JSON TO CLASS => https://json2csharp.com 6 | //DUMMY JSON => https://dummyjson.com/products 7 | //.Net Core Library https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.dataannotations?view=net-8.0 8 | public class Product 9 | { 10 | public int id { get; set; } 11 | [DeniedValues("Bora","Cetvel","Kalem", ErrorMessage ="Gecersiz Urun")] 12 | public string title { get; set; } 13 | [Length(50, 100)] 14 | public string description { get; set; } 15 | public int price { get; set; } 16 | [Range(1, 20, MinimumIsExclusive = true, MaximumIsExclusive = true)] 17 | public double discountPercentage { get; set; } 18 | public double rating { get; set; } 19 | public int stock { get; set; } 20 | public string brand { get; set; } 21 | public string category { get; set; } 22 | public string thumbnail { get; set; } 23 | public List images { get; set; } 24 | } 25 | 26 | public class ResultModel 27 | { 28 | public List products { get; set; } 29 | public int total { get; set; } 30 | public int skip { get; set; } 31 | [AllowedValues(20,30,50,ErrorMessage ="Boyle Limit Olmaz Olsun :)")] 32 | public int limit { get; set; } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /DAL8/obj/Debug/net8.0/DAL8.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | C:\Users\Bora Kasmer\source\repos\GenericAttributeBlog\DAL8\bin\Debug\net8.0\DAL8.deps.json 2 | C:\Users\Bora Kasmer\source\repos\GenericAttributeBlog\DAL8\bin\Debug\net8.0\DAL8.dll 3 | C:\Users\Bora Kasmer\source\repos\GenericAttributeBlog\DAL8\bin\Debug\net8.0\DAL8.pdb 4 | C:\Users\Bora Kasmer\source\repos\GenericAttributeBlog\DAL8\obj\Debug\net8.0\DAL8.GeneratedMSBuildEditorConfig.editorconfig 5 | C:\Users\Bora Kasmer\source\repos\GenericAttributeBlog\DAL8\obj\Debug\net8.0\DAL8.AssemblyInfoInputs.cache 6 | C:\Users\Bora Kasmer\source\repos\GenericAttributeBlog\DAL8\obj\Debug\net8.0\DAL8.AssemblyInfo.cs 7 | C:\Users\Bora Kasmer\source\repos\GenericAttributeBlog\DAL8\obj\Debug\net8.0\DAL8.csproj.CoreCompileInputs.cache 8 | C:\Users\Bora Kasmer\source\repos\GenericAttributeBlog\DAL8\obj\Debug\net8.0\DAL8.dll 9 | C:\Users\Bora Kasmer\source\repos\GenericAttributeBlog\DAL8\obj\Debug\net8.0\refint\DAL8.dll 10 | C:\Users\Bora Kasmer\source\repos\GenericAttributeBlog\DAL8\obj\Debug\net8.0\DAL8.pdb 11 | C:\Users\Bora Kasmer\source\repos\GenericAttributeBlog\DAL8\obj\Debug\net8.0\ref\DAL8.dll 12 | C:\Users\Bora Kasmer\source\repos\GenericAttributeBlog\DAL8\bin\Debug\net8.0\DAL8.runtimeconfig.json 13 | C:\Users\Bora Kasmer\source\repos\GenericAttributeBlog\DAL8\obj\Debug\net8.0\DAL8.csproj.AssemblyReference.cache 14 | C:\Users\Bora Kasmer\source\repos\GenericAttributeBlog\DAL8\obj\Debug\net8.0\DAL8.genruntimeconfig.cache 15 | -------------------------------------------------------------------------------- /DAL8/obj/Release/net8.0/DAL8.csproj.FileListAbsolute.txt: -------------------------------------------------------------------------------- 1 | C:\Users\Bora Kasmer\source\repos\GenericAttributeBlog\DAL8\bin\Release\net8.0\DAL8.deps.json 2 | C:\Users\Bora Kasmer\source\repos\GenericAttributeBlog\DAL8\bin\Release\net8.0\DAL8.runtimeconfig.json 3 | C:\Users\Bora Kasmer\source\repos\GenericAttributeBlog\DAL8\bin\Release\net8.0\DAL8.dll 4 | C:\Users\Bora Kasmer\source\repos\GenericAttributeBlog\DAL8\bin\Release\net8.0\DAL8.pdb 5 | C:\Users\Bora Kasmer\source\repos\GenericAttributeBlog\DAL8\obj\Release\net8.0\DAL8.csproj.AssemblyReference.cache 6 | C:\Users\Bora Kasmer\source\repos\GenericAttributeBlog\DAL8\obj\Release\net8.0\DAL8.GeneratedMSBuildEditorConfig.editorconfig 7 | C:\Users\Bora Kasmer\source\repos\GenericAttributeBlog\DAL8\obj\Release\net8.0\DAL8.AssemblyInfoInputs.cache 8 | C:\Users\Bora Kasmer\source\repos\GenericAttributeBlog\DAL8\obj\Release\net8.0\DAL8.AssemblyInfo.cs 9 | C:\Users\Bora Kasmer\source\repos\GenericAttributeBlog\DAL8\obj\Release\net8.0\DAL8.csproj.CoreCompileInputs.cache 10 | C:\Users\Bora Kasmer\source\repos\GenericAttributeBlog\DAL8\obj\Release\net8.0\DAL8.dll 11 | C:\Users\Bora Kasmer\source\repos\GenericAttributeBlog\DAL8\obj\Release\net8.0\refint\DAL8.dll 12 | C:\Users\Bora Kasmer\source\repos\GenericAttributeBlog\DAL8\obj\Release\net8.0\DAL8.pdb 13 | C:\Users\Bora Kasmer\source\repos\GenericAttributeBlog\DAL8\obj\Release\net8.0\DAL8.genruntimeconfig.cache 14 | C:\Users\Bora Kasmer\source\repos\GenericAttributeBlog\DAL8\obj\Release\net8.0\ref\DAL8.dll 15 | -------------------------------------------------------------------------------- /DAL8/Models/DB/Employee.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DAL8.Models.DB; 5 | 6 | public partial class Employee 7 | { 8 | public int EmployeeId { get; set; } 9 | 10 | public string LastName { get; set; } = null!; 11 | 12 | public string FirstName { get; set; } = null!; 13 | 14 | public string? Title { get; set; } 15 | 16 | public string? TitleOfCourtesy { get; set; } 17 | 18 | public DateTime? BirthDate { get; set; } 19 | 20 | public DateTime? HireDate { get; set; } 21 | 22 | public string? Address { get; set; } 23 | 24 | public string? City { get; set; } 25 | 26 | public string? Region { get; set; } 27 | 28 | public string? PostalCode { get; set; } 29 | 30 | public string? Country { get; set; } 31 | 32 | public string? HomePhone { get; set; } 33 | 34 | public string? Extension { get; set; } 35 | 36 | public byte[]? Photo { get; set; } 37 | 38 | public string? Notes { get; set; } 39 | 40 | public int? ReportsTo { get; set; } 41 | 42 | public string? PhotoPath { get; set; } 43 | 44 | public virtual ICollection InverseReportsToNavigation { get; set; } = new List(); 45 | 46 | public virtual ICollection Orders { get; set; } = new List(); 47 | 48 | public virtual Employee? ReportsToNavigation { get; set; } 49 | 50 | public virtual ICollection Territories { get; set; } = new List(); 51 | } 52 | -------------------------------------------------------------------------------- /Program.cs: -------------------------------------------------------------------------------- 1 | using DAL8.Models.DB; 2 | using Net8Features; 3 | 4 | var builder = WebApplication.CreateBuilder(args); 5 | 6 | var configuration = new ConfigurationBuilder() 7 | .SetBasePath(Directory.GetCurrentDirectory()) 8 | .AddJsonFile("appsettings.json", false, true) 9 | .Build(); 10 | 11 | builder.Services.AddTransient(); 12 | builder.Services.AddKeyedScoped("scoped"); 13 | 14 | builder.Services.Configure(configuration.GetSection("WeatherServiceOptions")); 15 | // Add services to the container. 16 | 17 | builder.Services.AddControllers(); 18 | builder.Services.AddKeyedTransient("weather"); 19 | builder.Services.AddKeyedTransient("weather2"); 20 | 21 | builder.Services.AddTransient(serviceProvider => 22 | { 23 | var key = configuration.GetSection("WeatherServiceOptions")["ServiceName"]; 24 | return serviceProvider.GetRequiredKeyedService(key); 25 | }); 26 | 27 | // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle 28 | builder.Services.AddEndpointsApiExplorer(); 29 | builder.Services.AddSwaggerGen(); 30 | 31 | var app = builder.Build(); 32 | 33 | // Configure the HTTP request pipeline. 34 | if (app.Environment.IsDevelopment()) 35 | { 36 | app.UseSwagger(); 37 | app.UseSwaggerUI(); 38 | } 39 | 40 | app.UseHttpsRedirection(); 41 | 42 | app.UseAuthorization(); 43 | 44 | app.MapControllers(); 45 | 46 | app.Run(); 47 | -------------------------------------------------------------------------------- /DAL8/Models/DB/Invoice.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace DAL8.Models.DB; 5 | 6 | public partial class Invoice 7 | { 8 | public string? ShipName { get; set; } 9 | 10 | public string? ShipAddress { get; set; } 11 | 12 | public string? ShipCity { get; set; } 13 | 14 | public string? ShipRegion { get; set; } 15 | 16 | public string? ShipPostalCode { get; set; } 17 | 18 | public string? ShipCountry { get; set; } 19 | 20 | public string? CustomerId { get; set; } 21 | 22 | public string CustomerName { get; set; } = null!; 23 | 24 | public string? Address { get; set; } 25 | 26 | public string? City { get; set; } 27 | 28 | public string? Region { get; set; } 29 | 30 | public string? PostalCode { get; set; } 31 | 32 | public string? Country { get; set; } 33 | 34 | public string Salesperson { get; set; } = null!; 35 | 36 | public int OrderId { get; set; } 37 | 38 | public DateTime? OrderDate { get; set; } 39 | 40 | public DateTime? RequiredDate { get; set; } 41 | 42 | public DateTime? ShippedDate { get; set; } 43 | 44 | public string ShipperName { get; set; } = null!; 45 | 46 | public int ProductId { get; set; } 47 | 48 | public string ProductName { get; set; } = null!; 49 | 50 | public decimal UnitPrice { get; set; } 51 | 52 | public short Quantity { get; set; } 53 | 54 | public float Discount { get; set; } 55 | 56 | public decimal? ExtendedPrice { get; set; } 57 | 58 | public decimal? Freight { get; set; } 59 | } 60 | -------------------------------------------------------------------------------- /Net8Features.sln: -------------------------------------------------------------------------------- 1 | 2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 17 4 | VisualStudioVersion = 17.8.34309.116 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Net8Features", "Net8Features.csproj", "{90BC51D3-9EC9-4F4D-BF76-BE746FC8DBAC}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DAL8", "..\DAL8\DAL8.csproj", "{2BD31B43-BD90-4E72-80C0-A04C9FA644D4}" 9 | EndProject 10 | Global 11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 12 | Debug|Any CPU = Debug|Any CPU 13 | Release|Any CPU = Release|Any CPU 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {90BC51D3-9EC9-4F4D-BF76-BE746FC8DBAC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {90BC51D3-9EC9-4F4D-BF76-BE746FC8DBAC}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {90BC51D3-9EC9-4F4D-BF76-BE746FC8DBAC}.Release|Any CPU.ActiveCfg = Release|Any CPU 19 | {90BC51D3-9EC9-4F4D-BF76-BE746FC8DBAC}.Release|Any CPU.Build.0 = Release|Any CPU 20 | {2BD31B43-BD90-4E72-80C0-A04C9FA644D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 21 | {2BD31B43-BD90-4E72-80C0-A04C9FA644D4}.Debug|Any CPU.Build.0 = Debug|Any CPU 22 | {2BD31B43-BD90-4E72-80C0-A04C9FA644D4}.Release|Any CPU.ActiveCfg = Release|Any CPU 23 | {2BD31B43-BD90-4E72-80C0-A04C9FA644D4}.Release|Any CPU.Build.0 = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {91610EB7-BED7-4BF2-9069-B8307D65B026} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /DAL8/obj/DAL8.csproj.EntityFrameworkCore.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /Controllers/WeatherTestController.cs: -------------------------------------------------------------------------------- 1 | using DAL8.Models.DB; 2 | using Microsoft.AspNetCore.Mvc; 3 | using Microsoft.Extensions.Options; 4 | using Net8Features.Models; 5 | using System; 6 | using System.Collections.Frozen; 7 | using CW = System.Diagnostics.Debug; 8 | namespace Net8Features.Controllers 9 | { 10 | [ApiController] 11 | [Route("[controller]")] 12 | public class WeatherTestController : ControllerBase 13 | { 14 | IWeatherService _service; 15 | IServiceProvider _serviceProvider; 16 | public WeatherTestController(IWeatherService service, IServiceProvider serviceProvider) 17 | { 18 | 19 | _service = service; 20 | _serviceProvider = serviceProvider; 21 | } 22 | 23 | [HttpGet("GetTestWeatherForecast")] 24 | //public List Get([FromKeyedServices(_config.Value.ServiceName)] IWeatherService service) 25 | public IActionResult Get(int id) 26 | { 27 | _service.GetMyName(); 28 | return Ok(); 29 | } 30 | 31 | [HttpGet("GetUserByIDKeyedServiceScoped")] 32 | public User GetUserByIDKeyedServiceScoped([FromKeyedServices("scoped")] NorthwindContext dbContext, int id) 33 | { 34 | var result = dbContext.GetUserByID(id); 35 | return result; 36 | } 37 | 38 | [HttpGet("GetUserByIDKeyedServiceTransient/{id}")] 39 | public User GetUserByIDKeyedServiceTransient(NorthwindContext dbContext, int id) 40 | { 41 | var result = dbContext.GetUserByID(id); 42 | return result; 43 | } 44 | 45 | [HttpGet("GetUserByIDKeyedServiceProvider/{serviceType}")] 46 | public IActionResult GetUserByIDKeyedServiceProvider(ServiceType serviceType) 47 | { 48 | var weatherService = _serviceProvider.GetRequiredKeyedService(serviceType.ToString()); 49 | weatherService.GetMyName(); 50 | return Ok(); 51 | } 52 | 53 | [HttpGet("TestStreamingDeserialization")] 54 | public Task> TestStreamingDeserialization([FromKeyedServices("weather2")] IWeatherService service) 55 | { 56 | return service.GetAllCodPlayers(); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /DAL8/obj/DAL8.csproj.nuget.g.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | True 5 | NuGet 6 | $(MSBuildThisFileDirectory)project.assets.json 7 | $(UserProfile)\.nuget\packages\ 8 | C:\Users\Bora Kasmer\.nuget\packages\;C:\Program Files\dotnet\sdk\NuGetFallbackFolder 9 | PackageReference 10 | 6.8.0 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | C:\Users\Bora Kasmer\.nuget\packages\microsoft.codeanalysis.analyzers\3.3.3 22 | C:\Users\Bora Kasmer\.nuget\packages\microsoft.entityframeworkcore.tools\8.0.0 23 | 24 | -------------------------------------------------------------------------------- /WeatherService.cs: -------------------------------------------------------------------------------- 1 | using Con = System.Console; 2 | using Env = System.Environment; 3 | using GoogleMapPoint = (double latitude, double longitude, string name); 4 | using CW = System.Diagnostics.Debug; 5 | using Net8Features.Models; 6 | 7 | namespace Net8Features 8 | { 9 | public class WeatherService : IWeatherService 10 | { 11 | public void GetMyName() { Con.WriteLine($"Hello Bora Kasmer. Os Versin:{Env.OSVersion}"); GetMyName("Bill Gates"); } 12 | public void GetMyName(string name) 13 | { 14 | GoogleMapPoint mySchool = (38.8951, -77.0364, "ITU"); 15 | Con.WriteLine($"Hello {name}"); 16 | RedisCore redis = new(); 17 | var redisValue = redis.GetValue(); 18 | Con.WriteLine(redisValue); 19 | RedisCore redis2 = new(94, "Bill Gates", null, 60); 20 | var redisValue2 = redis2.GetValue(); 21 | Con.WriteLine(redisValue2); 22 | CW.WriteLine("WEATHER SERVICE"); 23 | } 24 | 25 | public async Task> GetAllCodPlayers() 26 | { 27 | using (HttpClient client = new()) 28 | { 29 | //https://json2csharp.com 30 | var players = client.GetFromJsonAsAsyncEnumerable("https://microsoftedge.github.io/Demos/json-dummy-data/64KB.json"); 31 | var shortPlayerList = new List(); 32 | await foreach (var player in players) 33 | { 34 | shortPlayerList.Add(new ShortCodPlayers() { name = player.name, version = player.version }); 35 | } 36 | 37 | return shortPlayerList.OrderBy(x => x.version).ToList(); 38 | } 39 | } 40 | 41 | public class RedisPersonKeyGenerator(ref readonly int id, string name) 42 | { 43 | int num = id; 44 | public string RedisKey => $"person:{num.ToString()}:{name}"; 45 | } 46 | public class RedisCore(int id, string name, object val, int expireMinute) : RedisPersonKeyGenerator(id, name) 47 | { 48 | public RedisCore() : this(78, "bora", null, 30) { } // default RedisCore 49 | 50 | public int Id => id; 51 | public object Value => val; 52 | public TimeSpan ExpireTime = TimeSpan.FromMinutes(expireMinute); 53 | 54 | public string GetValue() 55 | { 56 | return $"RedisClient: Key={RedisKey}, Value:{Value}, ExpireTime:{ExpireTime}"; 57 | } 58 | } 59 | } 60 | } -------------------------------------------------------------------------------- /WeatherService2.cs: -------------------------------------------------------------------------------- 1 | using Con = System.Console; 2 | using Env = System.Environment; 3 | using GoogleMapPoint = (double latitude, double longitude, string name); 4 | using CW = System.Diagnostics.Debug; 5 | using Net8Features.Models; 6 | 7 | namespace Net8Features 8 | { 9 | public class WeatherService2 : IWeatherService 10 | { 11 | public void GetMyName() { Con.WriteLine($"Hello Bora Kasmer. Os Versin:{Env.OSVersion}"); GetMyName("Bill Gates"); } 12 | public void GetMyName(string name) 13 | { 14 | GoogleMapPoint mySchool = (38.8951, -77.0364, "ITU"); 15 | Con.WriteLine($"Hello {name}"); 16 | RedisCore redis = new(); 17 | var redisValue = redis.GetValue(); 18 | Con.WriteLine(redisValue); 19 | RedisCore redis2 = new(94, "Bill Gates", null, 60); 20 | var redisValue2 = redis2.GetValue(); 21 | Con.WriteLine(redisValue2); 22 | CW.WriteLine("WEATHER222 SERVICE"); 23 | } 24 | 25 | public async Task> GetAllCodPlayers() 26 | { 27 | using (HttpClient client = new()) 28 | { 29 | //https://json2csharp.com 30 | var players = client.GetFromJsonAsAsyncEnumerable("https://microsoftedge.github.io/Demos/json-dummy-data/64KB.json"); 31 | var shortPlayerList = new List(); 32 | await foreach (var player in players) 33 | { 34 | shortPlayerList.Add(new ShortCodPlayers() { name = player.name, version = player.version }); 35 | } 36 | 37 | return shortPlayerList.OrderBy(x=>x.version).ToList(); 38 | } 39 | } 40 | 41 | public class RedisPersonKeyGenerator(ref readonly int id, string name) 42 | { 43 | //id=5; 44 | int num = id; 45 | //public string RedisKey => $"person:{id.ToString()}:{name}"; 46 | public string RedisKey => $"person:{num.ToString()}:{name}"; 47 | } 48 | public class RedisCore(int id, string name, object val, int expireMinute) : RedisPersonKeyGenerator(id, name) 49 | { 50 | public RedisCore() : this(78, "bora", null, 30) { } // default RedisCore 51 | 52 | public int Id => id; 53 | public object Value => val; 54 | public TimeSpan ExpireTime = TimeSpan.FromMinutes(expireMinute); 55 | 56 | public string GetValue() 57 | { 58 | return $"RedisClient: Key={RedisKey}, Value:{Value}, ExpireTime:{ExpireTime}"; 59 | } 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /DAL8/obj/DAL8.csproj.nuget.dgspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "format": 1, 3 | "restore": { 4 | "C:\\Users\\Bora Kasmer\\source\\repos\\GenericAttributeBlog\\DAL8\\DAL8.csproj": {} 5 | }, 6 | "projects": { 7 | "C:\\Users\\Bora Kasmer\\source\\repos\\GenericAttributeBlog\\DAL8\\DAL8.csproj": { 8 | "version": "1.0.0", 9 | "restore": { 10 | "projectUniqueName": "C:\\Users\\Bora Kasmer\\source\\repos\\GenericAttributeBlog\\DAL8\\DAL8.csproj", 11 | "projectName": "DAL8", 12 | "projectPath": "C:\\Users\\Bora Kasmer\\source\\repos\\GenericAttributeBlog\\DAL8\\DAL8.csproj", 13 | "packagesPath": "C:\\Users\\Bora Kasmer\\.nuget\\packages\\", 14 | "outputPath": "C:\\Users\\Bora Kasmer\\source\\repos\\GenericAttributeBlog\\DAL8\\obj\\", 15 | "projectStyle": "PackageReference", 16 | "fallbackFolders": [ 17 | "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder" 18 | ], 19 | "configFilePaths": [ 20 | "C:\\Users\\Bora Kasmer\\AppData\\Roaming\\NuGet\\NuGet.Config", 21 | "C:\\Program Files (x86)\\NuGet\\Config\\Microsoft.VisualStudio.Offline.config" 22 | ], 23 | "originalTargetFrameworks": [ 24 | "net8.0" 25 | ], 26 | "sources": { 27 | "C:\\Program Files (x86)\\Microsoft SDKs\\NuGetPackages\\": {}, 28 | "https://api.nuget.org/v3/index.json": {} 29 | }, 30 | "frameworks": { 31 | "net8.0": { 32 | "targetAlias": "net8.0", 33 | "projectReferences": {} 34 | } 35 | }, 36 | "warningProperties": { 37 | "warnAsError": [ 38 | "NU1605" 39 | ] 40 | } 41 | }, 42 | "frameworks": { 43 | "net8.0": { 44 | "targetAlias": "net8.0", 45 | "dependencies": { 46 | "Microsoft.EntityFrameworkCore.Design": { 47 | "include": "Runtime, Build, Native, ContentFiles, Analyzers, BuildTransitive", 48 | "suppressParent": "All", 49 | "target": "Package", 50 | "version": "[8.0.0, )" 51 | }, 52 | "Microsoft.EntityFrameworkCore.SqlServer": { 53 | "target": "Package", 54 | "version": "[8.0.0, )" 55 | }, 56 | "Microsoft.EntityFrameworkCore.Tools": { 57 | "include": "Runtime, Build, Native, ContentFiles, Analyzers, BuildTransitive", 58 | "suppressParent": "All", 59 | "target": "Package", 60 | "version": "[8.0.0, )" 61 | } 62 | }, 63 | "imports": [ 64 | "net461", 65 | "net462", 66 | "net47", 67 | "net471", 68 | "net472", 69 | "net48", 70 | "net481" 71 | ], 72 | "assetTargetFallback": true, 73 | "warn": true, 74 | "frameworkReferences": { 75 | "Microsoft.NETCore.App": { 76 | "privateAssets": "all" 77 | } 78 | }, 79 | "runtimeIdentifierGraphPath": "C:\\Program Files\\dotnet\\sdk\\8.0.100/PortableRuntimeIdentifierGraph.json" 80 | } 81 | } 82 | } 83 | } 84 | } -------------------------------------------------------------------------------- /Controllers/WeatherForecastController.cs: -------------------------------------------------------------------------------- 1 | using DAL8.Models.DB; 2 | using Microsoft.AspNetCore.Mvc; 3 | using Microsoft.Extensions.Options; 4 | using Net8Features.Models; 5 | using System; 6 | using System.Collections.Frozen; 7 | using CW = System.Diagnostics.Debug; 8 | namespace Net8Features.Controllers 9 | { 10 | [ApiController] 11 | [Route("[controller]")] 12 | public class WeatherForecastController : ControllerBase 13 | { 14 | //private static readonly string[] Summaries = new[] 15 | //{ 16 | // "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching" 17 | //}; 18 | private static readonly string[] Summaries = ["Freezing", 19 | "Bracing", 20 | "Chilly", 21 | "Cool", 22 | "Mild", 23 | "Warm", 24 | "Balmy", 25 | "Hot", 26 | "Sweltering", 27 | "Scorching"]; 28 | int[][] twoD = [[1, 1, 2], [4, 5, 6], [7, 8]]; 29 | Dictionary dict = []; 30 | 31 | FrozenDictionary dicktFrozen; 32 | FrozenSet frozenSummary = Summaries.ToFrozenSet(); 33 | 34 | public readonly IOptionsSnapshot _config; 35 | public WeatherForecastController(IOptionsSnapshot config) 36 | { 37 | _config = config; 38 | 39 | //LinqQuery ToFrozenSet 40 | var groupResult = Summaries.GroupBy(word => word.Length switch 41 | { 42 | <= 5 => word + "(<5)", 43 | > 5 and < 8 => word + "(>5)", 44 | _ => word + "(>8)", 45 | }).Select((g, id) => new { Name = g.Key, Id = id }).ToFrozenSet(); 46 | 47 | dicktFrozen = Summaries.ToList().Select((key, id) => (key, id)).ToFrozenDictionary(e => e.key, e => e.id); 48 | } 49 | [HttpGet("Shuffle")] 50 | public IOrderedEnumerable> GetShuffleList() 51 | { 52 | var serviceName = _config.Value.ServiceName; 53 | //Shuffle Example 54 | int[] numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; 55 | Random.Shared.Shuffle(numbers); 56 | return numbers.ToList().Select((key, id) => (key, id)) 57 | .ToFrozenDictionary(e => $"{e.key}. number =>", e => e.id) 58 | .OrderBy(x => int.Parse(x.Key.Replace(". number =>", ""))); 59 | } 60 | [HttpGet(Name = "GetWeatherForecast")] 61 | //public List Get([FromKeyedServices(_config.Value.ServiceName)] IWeatherService service) 62 | public List Get([FromKeyedServices("weather2")] IWeatherService service, int id) 63 | { 64 | //WeatherService service = new WeatherService(); 65 | service.GetMyName(); 66 | List list = new(); 67 | List weekDays = ["Pazartesi", "Sali", "Carsamba", "Persembe", "Cuma"]; 68 | //var randomSummaries = Random.Shared.GetItems(Summaries, 3); 69 | var randomSummaries = GetRandom(new List(), 5); 70 | //foreach (var item in Summaries) 71 | foreach (var item in randomSummaries) 72 | { 73 | dicktFrozen.TryGetValue(item, out int itemID); 74 | list.Add(itemID); 75 | } 76 | return list; 77 | } 78 | [HttpGet("GetRomanNumber")] 79 | public int Get(string number) 80 | { 81 | using (HttpClient client = new()) 82 | { 83 | var products = client.GetFromJsonAsync("https://dummyjson.com/products"); 84 | } 85 | return GetRomanNumberValue(number); 86 | } 87 | [HttpGet("GetAllProducts")] 88 | public async Task GetAllProducts() 89 | { 90 | using (HttpClient client = new()) 91 | { 92 | var products = await client.GetFromJsonAsync("https://dummyjson.com/products/"); 93 | 94 | //Global Using Example 95 | var dicktProduct = products.products.Select((key, id) => (key, id)).ToFrozenDictionary(e => e.key, e => e.id); 96 | ShoppingData data = new() 97 | { 98 | Type = Models.ServiceType.weather, 99 | Basket = dicktProduct 100 | }; 101 | //-------------- 102 | return products ?? new Models.ResultModel(); 103 | } 104 | // 105 | } 106 | [HttpGet("GetProductByID")] 107 | public async Task GetProductByID(int? number) 108 | { 109 | using (HttpClient client = new()) 110 | { 111 | var products = await client.GetFromJsonAsync($"https://dummyjson.com/products/{number}"); 112 | return products ?? new Models.Product(); 113 | } 114 | } 115 | [HttpGet("GetUserByID")] 116 | public User GetUserByID(int id) 117 | { 118 | using (var dbContext = new NorthwindContext()) 119 | { 120 | var result = dbContext.GetUserByID(id); 121 | return result; 122 | } 123 | } 124 | [ApiExplorerSettings(IgnoreApi = true)] 125 | public List GetRandom(List list, int totalCount) 126 | { 127 | var addRandomItems = list.Count() < totalCount ? Random.Shared.GetItems(Summaries.Except(list). 128 | ToArray(), (totalCount - list.Count())).Distinct().ToList() : list; 129 | list.AddRange(addRandomItems); 130 | if (list.Count() < totalCount) GetRandom(list, totalCount); 131 | return list; 132 | } 133 | [ApiExplorerSettings(IgnoreApi = true)] 134 | public int GetRomanNumberValue(string number) 135 | { 136 | return number switch 137 | { 138 | "X" => 10, 139 | "VIII" => 8, 140 | "III" => 3, 141 | "L" => 50, 142 | _ => 0 143 | }; 144 | } 145 | } 146 | 147 | /*public static class Interception 148 | { 149 | [InterceptsLocation("""C:\Users\Bora Kasmer\source\repos\GenericAttributeBlog\Net8Features\Controllers\WeatherForecastController.cs""", line: 32, character: 22)] 150 | public static void InterceptionName() 151 | { 152 | Console.WriteLine("Start Interception For Controller"); 153 | } 154 | }*/ 155 | } 156 | -------------------------------------------------------------------------------- /DAL8/obj/project.nuget.cache: -------------------------------------------------------------------------------- 1 | { 2 | "version": 2, 3 | "dgSpecHash": "cr+9BFpNCS2zj5jAV6XyQFP9zREZbAkKeuPxzOZjRfvd0imJDIz57BZkv43Qkd+Un1Tsr77eAy4eBD+FqEKQ6w==", 4 | "success": true, 5 | "projectFilePath": "C:\\Users\\Bora Kasmer\\source\\repos\\GenericAttributeBlog\\DAL8\\DAL8.csproj", 6 | "expectedPackageFiles": [ 7 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\azure.core\\1.25.0\\azure.core.1.25.0.nupkg.sha512", 8 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\azure.identity\\1.7.0\\azure.identity.1.7.0.nupkg.sha512", 9 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\humanizer.core\\2.14.1\\humanizer.core.2.14.1.nupkg.sha512", 10 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.bcl.asyncinterfaces\\6.0.0\\microsoft.bcl.asyncinterfaces.6.0.0.nupkg.sha512", 11 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.codeanalysis.analyzers\\3.3.3\\microsoft.codeanalysis.analyzers.3.3.3.nupkg.sha512", 12 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.codeanalysis.common\\4.5.0\\microsoft.codeanalysis.common.4.5.0.nupkg.sha512", 13 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.codeanalysis.csharp\\4.5.0\\microsoft.codeanalysis.csharp.4.5.0.nupkg.sha512", 14 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.codeanalysis.csharp.workspaces\\4.5.0\\microsoft.codeanalysis.csharp.workspaces.4.5.0.nupkg.sha512", 15 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.codeanalysis.workspaces.common\\4.5.0\\microsoft.codeanalysis.workspaces.common.4.5.0.nupkg.sha512", 16 | "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder\\microsoft.csharp\\4.5.0\\microsoft.csharp.4.5.0.nupkg.sha512", 17 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.data.sqlclient\\5.1.1\\microsoft.data.sqlclient.5.1.1.nupkg.sha512", 18 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.data.sqlclient.sni.runtime\\5.1.0\\microsoft.data.sqlclient.sni.runtime.5.1.0.nupkg.sha512", 19 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.entityframeworkcore\\8.0.0\\microsoft.entityframeworkcore.8.0.0.nupkg.sha512", 20 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.entityframeworkcore.abstractions\\8.0.0\\microsoft.entityframeworkcore.abstractions.8.0.0.nupkg.sha512", 21 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.entityframeworkcore.analyzers\\8.0.0\\microsoft.entityframeworkcore.analyzers.8.0.0.nupkg.sha512", 22 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.entityframeworkcore.design\\8.0.0\\microsoft.entityframeworkcore.design.8.0.0.nupkg.sha512", 23 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.entityframeworkcore.relational\\8.0.0\\microsoft.entityframeworkcore.relational.8.0.0.nupkg.sha512", 24 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.entityframeworkcore.sqlserver\\8.0.0\\microsoft.entityframeworkcore.sqlserver.8.0.0.nupkg.sha512", 25 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.entityframeworkcore.tools\\8.0.0\\microsoft.entityframeworkcore.tools.8.0.0.nupkg.sha512", 26 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.extensions.caching.abstractions\\8.0.0\\microsoft.extensions.caching.abstractions.8.0.0.nupkg.sha512", 27 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.extensions.caching.memory\\8.0.0\\microsoft.extensions.caching.memory.8.0.0.nupkg.sha512", 28 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.extensions.configuration.abstractions\\8.0.0\\microsoft.extensions.configuration.abstractions.8.0.0.nupkg.sha512", 29 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.extensions.dependencyinjection\\8.0.0\\microsoft.extensions.dependencyinjection.8.0.0.nupkg.sha512", 30 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.extensions.dependencyinjection.abstractions\\8.0.0\\microsoft.extensions.dependencyinjection.abstractions.8.0.0.nupkg.sha512", 31 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.extensions.dependencymodel\\8.0.0\\microsoft.extensions.dependencymodel.8.0.0.nupkg.sha512", 32 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.extensions.logging\\8.0.0\\microsoft.extensions.logging.8.0.0.nupkg.sha512", 33 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.extensions.logging.abstractions\\8.0.0\\microsoft.extensions.logging.abstractions.8.0.0.nupkg.sha512", 34 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.extensions.options\\8.0.0\\microsoft.extensions.options.8.0.0.nupkg.sha512", 35 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.extensions.primitives\\8.0.0\\microsoft.extensions.primitives.8.0.0.nupkg.sha512", 36 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.identity.client\\4.47.2\\microsoft.identity.client.4.47.2.nupkg.sha512", 37 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.identity.client.extensions.msal\\2.19.3\\microsoft.identity.client.extensions.msal.2.19.3.nupkg.sha512", 38 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.identitymodel.abstractions\\6.24.0\\microsoft.identitymodel.abstractions.6.24.0.nupkg.sha512", 39 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.identitymodel.jsonwebtokens\\6.24.0\\microsoft.identitymodel.jsonwebtokens.6.24.0.nupkg.sha512", 40 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.identitymodel.logging\\6.24.0\\microsoft.identitymodel.logging.6.24.0.nupkg.sha512", 41 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.identitymodel.protocols\\6.24.0\\microsoft.identitymodel.protocols.6.24.0.nupkg.sha512", 42 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.identitymodel.protocols.openidconnect\\6.24.0\\microsoft.identitymodel.protocols.openidconnect.6.24.0.nupkg.sha512", 43 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.identitymodel.tokens\\6.24.0\\microsoft.identitymodel.tokens.6.24.0.nupkg.sha512", 44 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.netcore.platforms\\1.1.0\\microsoft.netcore.platforms.1.1.0.nupkg.sha512", 45 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.netcore.targets\\1.1.0\\microsoft.netcore.targets.1.1.0.nupkg.sha512", 46 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.sqlserver.server\\1.0.0\\microsoft.sqlserver.server.1.0.0.nupkg.sha512", 47 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\microsoft.win32.systemevents\\6.0.0\\microsoft.win32.systemevents.6.0.0.nupkg.sha512", 48 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\mono.texttemplating\\2.2.1\\mono.texttemplating.2.2.1.nupkg.sha512", 49 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\system.codedom\\4.4.0\\system.codedom.4.4.0.nupkg.sha512", 50 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\system.collections.immutable\\6.0.0\\system.collections.immutable.6.0.0.nupkg.sha512", 51 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\system.composition\\6.0.0\\system.composition.6.0.0.nupkg.sha512", 52 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\system.composition.attributedmodel\\6.0.0\\system.composition.attributedmodel.6.0.0.nupkg.sha512", 53 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\system.composition.convention\\6.0.0\\system.composition.convention.6.0.0.nupkg.sha512", 54 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\system.composition.hosting\\6.0.0\\system.composition.hosting.6.0.0.nupkg.sha512", 55 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\system.composition.runtime\\6.0.0\\system.composition.runtime.6.0.0.nupkg.sha512", 56 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\system.composition.typedparts\\6.0.0\\system.composition.typedparts.6.0.0.nupkg.sha512", 57 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\system.configuration.configurationmanager\\6.0.1\\system.configuration.configurationmanager.6.0.1.nupkg.sha512", 58 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\system.diagnostics.diagnosticsource\\6.0.0\\system.diagnostics.diagnosticsource.6.0.0.nupkg.sha512", 59 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\system.drawing.common\\6.0.0\\system.drawing.common.6.0.0.nupkg.sha512", 60 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\system.formats.asn1\\5.0.0\\system.formats.asn1.5.0.0.nupkg.sha512", 61 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\system.identitymodel.tokens.jwt\\6.24.0\\system.identitymodel.tokens.jwt.6.24.0.nupkg.sha512", 62 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\system.io.pipelines\\6.0.3\\system.io.pipelines.6.0.3.nupkg.sha512", 63 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\system.memory\\4.5.4\\system.memory.4.5.4.nupkg.sha512", 64 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\system.memory.data\\1.0.2\\system.memory.data.1.0.2.nupkg.sha512", 65 | "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder\\system.numerics.vectors\\4.5.0\\system.numerics.vectors.4.5.0.nupkg.sha512", 66 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\system.reflection.metadata\\6.0.1\\system.reflection.metadata.6.0.1.nupkg.sha512", 67 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\system.runtime\\4.3.0\\system.runtime.4.3.0.nupkg.sha512", 68 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\system.runtime.caching\\6.0.0\\system.runtime.caching.6.0.0.nupkg.sha512", 69 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\system.runtime.compilerservices.unsafe\\6.0.0\\system.runtime.compilerservices.unsafe.6.0.0.nupkg.sha512", 70 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\system.security.accesscontrol\\6.0.0\\system.security.accesscontrol.6.0.0.nupkg.sha512", 71 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\system.security.cryptography.cng\\5.0.0\\system.security.cryptography.cng.5.0.0.nupkg.sha512", 72 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\system.security.cryptography.protecteddata\\6.0.0\\system.security.cryptography.protecteddata.6.0.0.nupkg.sha512", 73 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\system.security.permissions\\6.0.0\\system.security.permissions.6.0.0.nupkg.sha512", 74 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\system.security.principal.windows\\5.0.0\\system.security.principal.windows.5.0.0.nupkg.sha512", 75 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\system.text.encoding\\4.3.0\\system.text.encoding.4.3.0.nupkg.sha512", 76 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\system.text.encoding.codepages\\6.0.0\\system.text.encoding.codepages.6.0.0.nupkg.sha512", 77 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\system.text.encodings.web\\8.0.0\\system.text.encodings.web.8.0.0.nupkg.sha512", 78 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\system.text.json\\8.0.0\\system.text.json.8.0.0.nupkg.sha512", 79 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\system.threading.channels\\6.0.0\\system.threading.channels.6.0.0.nupkg.sha512", 80 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\system.threading.tasks.extensions\\4.5.4\\system.threading.tasks.extensions.4.5.4.nupkg.sha512", 81 | "C:\\Users\\Bora Kasmer\\.nuget\\packages\\system.windows.extensions\\6.0.0\\system.windows.extensions.6.0.0.nupkg.sha512" 82 | ], 83 | "logs": [] 84 | } -------------------------------------------------------------------------------- /DAL8/Models/DB/NorthwindContext.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using Microsoft.EntityFrameworkCore; 4 | 5 | namespace DAL8.Models.DB; 6 | 7 | public partial class NorthwindContext : DbContext 8 | { 9 | private static readonly Func _getUserByID = 10 | EF.CompileQuery( 11 | (NorthwindContext dbContext, int id) => 12 | dbContext.Users.FirstOrDefault(_ => _.Id == id)); 13 | 14 | public User? GetUserByID(int id) => _getUserByID(this, id); 15 | 16 | public NorthwindContext() 17 | { 18 | } 19 | 20 | public NorthwindContext(DbContextOptions options) 21 | : base(options) 22 | { 23 | } 24 | 25 | public virtual DbSet Actions { get; set; } 26 | 27 | public virtual DbSet AlphabeticalListOfProducts { get; set; } 28 | 29 | public virtual DbSet Categories { get; set; } 30 | 31 | public virtual DbSet CategorySalesFor1997s { get; set; } 32 | 33 | public virtual DbSet CurrentProductLists { get; set; } 34 | 35 | public virtual DbSet Customers { get; set; } 36 | 37 | public virtual DbSet CustomerAndSuppliersByCities { get; set; } 38 | 39 | public virtual DbSet CustomerDemographics { get; set; } 40 | 41 | public virtual DbSet Employees { get; set; } 42 | 43 | public virtual DbSet Invoices { get; set; } 44 | 45 | public virtual DbSet Modules { get; set; } 46 | 47 | public virtual DbSet Orders { get; set; } 48 | 49 | public virtual DbSet OrderDetails { get; set; } 50 | 51 | public virtual DbSet OrderDetailsExtendeds { get; set; } 52 | 53 | public virtual DbSet OrderSubtotals { get; set; } 54 | 55 | public virtual DbSet OrdersQries { get; set; } 56 | 57 | public virtual DbSet Products { get; set; } 58 | 59 | public virtual DbSet ProductSalesFor1997s { get; set; } 60 | 61 | public virtual DbSet ProductsAboveAveragePrices { get; set; } 62 | 63 | public virtual DbSet ProductsByCategories { get; set; } 64 | 65 | public virtual DbSet QuarterlyOrders { get; set; } 66 | 67 | public virtual DbSet Regions { get; set; } 68 | 69 | public virtual DbSet Roles { get; set; } 70 | 71 | public virtual DbSet RoleGroups { get; set; } 72 | 73 | public virtual DbSet SalesByCategories { get; set; } 74 | 75 | public virtual DbSet SalesTotalsByAmounts { get; set; } 76 | 77 | public virtual DbSet Shippers { get; set; } 78 | 79 | public virtual DbSet SummaryOfSalesByQuarters { get; set; } 80 | 81 | public virtual DbSet SummaryOfSalesByYears { get; set; } 82 | 83 | public virtual DbSet Suppliers { get; set; } 84 | 85 | public virtual DbSet Territories { get; set; } 86 | 87 | public virtual DbSet Users { get; set; } 88 | 89 | public virtual DbSet UserActions { get; set; } 90 | 91 | public virtual DbSet UserRoles { get; set; } 92 | 93 | public virtual DbSet VwCustomerProducts { get; set; } 94 | 95 | protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) 96 | #warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see https://go.microsoft.com/fwlink/?LinkId=723263. 97 | => optionsBuilder.UseSqlServer("Server=.;Database=Northwind; User ID=sa; Password=YourPassword...;encrypt=false"); 98 | 99 | protected override void OnModelCreating(ModelBuilder modelBuilder) 100 | { 101 | modelBuilder.Entity(entity => 102 | { 103 | entity.Property(e => e.ActionName).HasMaxLength(50); 104 | entity.Property(e => e.IsDeleted).HasDefaultValue(false); 105 | 106 | entity.HasOne(d => d.IdModuleNavigation).WithMany(p => p.Actions) 107 | .HasForeignKey(d => d.IdModule) 108 | .HasConstraintName("FK_Actions_Modules"); 109 | }); 110 | 111 | modelBuilder.Entity(entity => 112 | { 113 | entity 114 | .HasNoKey() 115 | .ToView("Alphabetical list of products"); 116 | 117 | entity.Property(e => e.CategoryId).HasColumnName("CategoryID"); 118 | entity.Property(e => e.CategoryName).HasMaxLength(15); 119 | entity.Property(e => e.ProductId).HasColumnName("ProductID"); 120 | entity.Property(e => e.ProductName).HasMaxLength(40); 121 | entity.Property(e => e.QuantityPerUnit).HasMaxLength(20); 122 | entity.Property(e => e.SupplierId).HasColumnName("SupplierID"); 123 | entity.Property(e => e.UnitPrice).HasColumnType("money"); 124 | }); 125 | 126 | modelBuilder.Entity(entity => 127 | { 128 | entity.HasIndex(e => e.CategoryName, "CategoryName"); 129 | 130 | entity.Property(e => e.CategoryId).HasColumnName("CategoryID"); 131 | entity.Property(e => e.CategoryName).HasMaxLength(15); 132 | entity.Property(e => e.Description).HasColumnType("ntext"); 133 | entity.Property(e => e.Picture).HasColumnType("image"); 134 | }); 135 | 136 | modelBuilder.Entity(entity => 137 | { 138 | entity 139 | .HasNoKey() 140 | .ToView("Category Sales for 1997"); 141 | 142 | entity.Property(e => e.CategoryName).HasMaxLength(15); 143 | entity.Property(e => e.CategorySales).HasColumnType("money"); 144 | }); 145 | 146 | modelBuilder.Entity(entity => 147 | { 148 | entity 149 | .HasNoKey() 150 | .ToView("Current Product List"); 151 | 152 | entity.Property(e => e.ProductId) 153 | .ValueGeneratedOnAdd() 154 | .HasColumnName("ProductID"); 155 | entity.Property(e => e.ProductName).HasMaxLength(40); 156 | }); 157 | 158 | modelBuilder.Entity(entity => 159 | { 160 | entity.HasIndex(e => e.City, "City"); 161 | 162 | entity.HasIndex(e => e.CompanyName, "CompanyName"); 163 | 164 | entity.HasIndex(e => e.PostalCode, "PostalCode"); 165 | 166 | entity.HasIndex(e => e.Region, "Region"); 167 | 168 | entity.Property(e => e.CustomerId) 169 | .HasMaxLength(5) 170 | .IsFixedLength() 171 | .HasColumnName("CustomerID"); 172 | entity.Property(e => e.Address).HasMaxLength(60); 173 | entity.Property(e => e.City).HasMaxLength(15); 174 | entity.Property(e => e.CompanyName).HasMaxLength(40); 175 | entity.Property(e => e.ContactName).HasMaxLength(30); 176 | entity.Property(e => e.ContactTitle).HasMaxLength(30); 177 | entity.Property(e => e.Country).HasMaxLength(15); 178 | entity.Property(e => e.Fax).HasMaxLength(24); 179 | entity.Property(e => e.Phone).HasMaxLength(24); 180 | entity.Property(e => e.PostalCode).HasMaxLength(10); 181 | entity.Property(e => e.Region).HasMaxLength(15); 182 | 183 | entity.HasMany(d => d.CustomerTypes).WithMany(p => p.Customers) 184 | .UsingEntity>( 185 | "CustomerCustomerDemo", 186 | r => r.HasOne().WithMany() 187 | .HasForeignKey("CustomerTypeId") 188 | .OnDelete(DeleteBehavior.ClientSetNull) 189 | .HasConstraintName("FK_CustomerCustomerDemo"), 190 | l => l.HasOne().WithMany() 191 | .HasForeignKey("CustomerId") 192 | .OnDelete(DeleteBehavior.ClientSetNull) 193 | .HasConstraintName("FK_CustomerCustomerDemo_Customers"), 194 | j => 195 | { 196 | j.HasKey("CustomerId", "CustomerTypeId").IsClustered(false); 197 | j.ToTable("CustomerCustomerDemo"); 198 | j.IndexerProperty("CustomerId") 199 | .HasMaxLength(5) 200 | .IsFixedLength() 201 | .HasColumnName("CustomerID"); 202 | j.IndexerProperty("CustomerTypeId") 203 | .HasMaxLength(10) 204 | .IsFixedLength() 205 | .HasColumnName("CustomerTypeID"); 206 | }); 207 | }); 208 | 209 | modelBuilder.Entity(entity => 210 | { 211 | entity 212 | .HasNoKey() 213 | .ToView("Customer and Suppliers by City"); 214 | 215 | entity.Property(e => e.City).HasMaxLength(15); 216 | entity.Property(e => e.CompanyName).HasMaxLength(40); 217 | entity.Property(e => e.ContactName).HasMaxLength(30); 218 | entity.Property(e => e.Relationship) 219 | .HasMaxLength(9) 220 | .IsUnicode(false); 221 | }); 222 | 223 | modelBuilder.Entity(entity => 224 | { 225 | entity.HasKey(e => e.CustomerTypeId).IsClustered(false); 226 | 227 | entity.Property(e => e.CustomerTypeId) 228 | .HasMaxLength(10) 229 | .IsFixedLength() 230 | .HasColumnName("CustomerTypeID"); 231 | entity.Property(e => e.CustomerDesc).HasColumnType("ntext"); 232 | }); 233 | 234 | modelBuilder.Entity(entity => 235 | { 236 | entity.HasIndex(e => e.LastName, "LastName"); 237 | 238 | entity.HasIndex(e => e.PostalCode, "PostalCode"); 239 | 240 | entity.Property(e => e.EmployeeId).HasColumnName("EmployeeID"); 241 | entity.Property(e => e.Address).HasMaxLength(60); 242 | entity.Property(e => e.BirthDate).HasColumnType("datetime"); 243 | entity.Property(e => e.City).HasMaxLength(15); 244 | entity.Property(e => e.Country).HasMaxLength(15); 245 | entity.Property(e => e.Extension).HasMaxLength(4); 246 | entity.Property(e => e.FirstName).HasMaxLength(10); 247 | entity.Property(e => e.HireDate).HasColumnType("datetime"); 248 | entity.Property(e => e.HomePhone).HasMaxLength(24); 249 | entity.Property(e => e.LastName).HasMaxLength(20); 250 | entity.Property(e => e.Notes).HasColumnType("ntext"); 251 | entity.Property(e => e.Photo).HasColumnType("image"); 252 | entity.Property(e => e.PhotoPath).HasMaxLength(255); 253 | entity.Property(e => e.PostalCode).HasMaxLength(10); 254 | entity.Property(e => e.Region).HasMaxLength(15); 255 | entity.Property(e => e.Title).HasMaxLength(30); 256 | entity.Property(e => e.TitleOfCourtesy).HasMaxLength(25); 257 | 258 | entity.HasOne(d => d.ReportsToNavigation).WithMany(p => p.InverseReportsToNavigation) 259 | .HasForeignKey(d => d.ReportsTo) 260 | .HasConstraintName("FK_Employees_Employees"); 261 | 262 | entity.HasMany(d => d.Territories).WithMany(p => p.Employees) 263 | .UsingEntity>( 264 | "EmployeeTerritory", 265 | r => r.HasOne().WithMany() 266 | .HasForeignKey("TerritoryId") 267 | .OnDelete(DeleteBehavior.ClientSetNull) 268 | .HasConstraintName("FK_EmployeeTerritories_Territories"), 269 | l => l.HasOne().WithMany() 270 | .HasForeignKey("EmployeeId") 271 | .OnDelete(DeleteBehavior.ClientSetNull) 272 | .HasConstraintName("FK_EmployeeTerritories_Employees"), 273 | j => 274 | { 275 | j.HasKey("EmployeeId", "TerritoryId").IsClustered(false); 276 | j.ToTable("EmployeeTerritories"); 277 | j.IndexerProperty("EmployeeId").HasColumnName("EmployeeID"); 278 | j.IndexerProperty("TerritoryId") 279 | .HasMaxLength(20) 280 | .HasColumnName("TerritoryID"); 281 | }); 282 | }); 283 | 284 | modelBuilder.Entity(entity => 285 | { 286 | entity 287 | .HasNoKey() 288 | .ToView("Invoices"); 289 | 290 | entity.Property(e => e.Address).HasMaxLength(60); 291 | entity.Property(e => e.City).HasMaxLength(15); 292 | entity.Property(e => e.Country).HasMaxLength(15); 293 | entity.Property(e => e.CustomerId) 294 | .HasMaxLength(5) 295 | .IsFixedLength() 296 | .HasColumnName("CustomerID"); 297 | entity.Property(e => e.CustomerName).HasMaxLength(40); 298 | entity.Property(e => e.ExtendedPrice).HasColumnType("money"); 299 | entity.Property(e => e.Freight).HasColumnType("money"); 300 | entity.Property(e => e.OrderDate).HasColumnType("datetime"); 301 | entity.Property(e => e.OrderId).HasColumnName("OrderID"); 302 | entity.Property(e => e.PostalCode).HasMaxLength(10); 303 | entity.Property(e => e.ProductId).HasColumnName("ProductID"); 304 | entity.Property(e => e.ProductName).HasMaxLength(40); 305 | entity.Property(e => e.Region).HasMaxLength(15); 306 | entity.Property(e => e.RequiredDate).HasColumnType("datetime"); 307 | entity.Property(e => e.Salesperson).HasMaxLength(31); 308 | entity.Property(e => e.ShipAddress).HasMaxLength(60); 309 | entity.Property(e => e.ShipCity).HasMaxLength(15); 310 | entity.Property(e => e.ShipCountry).HasMaxLength(15); 311 | entity.Property(e => e.ShipName).HasMaxLength(40); 312 | entity.Property(e => e.ShipPostalCode).HasMaxLength(10); 313 | entity.Property(e => e.ShipRegion).HasMaxLength(15); 314 | entity.Property(e => e.ShippedDate).HasColumnType("datetime"); 315 | entity.Property(e => e.ShipperName).HasMaxLength(40); 316 | entity.Property(e => e.UnitPrice).HasColumnType("money"); 317 | }); 318 | 319 | modelBuilder.Entity(entity => 320 | { 321 | entity.Property(e => e.IsDeleted).HasDefaultValue(false); 322 | entity.Property(e => e.ModuleName).HasMaxLength(50); 323 | }); 324 | 325 | modelBuilder.Entity(entity => 326 | { 327 | entity.HasIndex(e => e.CustomerId, "CustomerID"); 328 | 329 | entity.HasIndex(e => e.CustomerId, "CustomersOrders"); 330 | 331 | entity.HasIndex(e => e.EmployeeId, "EmployeeID"); 332 | 333 | entity.HasIndex(e => e.EmployeeId, "EmployeesOrders"); 334 | 335 | entity.HasIndex(e => e.OrderDate, "OrderDate"); 336 | 337 | entity.HasIndex(e => e.ShipPostalCode, "ShipPostalCode"); 338 | 339 | entity.HasIndex(e => e.ShippedDate, "ShippedDate"); 340 | 341 | entity.HasIndex(e => e.ShipVia, "ShippersOrders"); 342 | 343 | entity.Property(e => e.OrderId).HasColumnName("OrderID"); 344 | entity.Property(e => e.CustomerId) 345 | .HasMaxLength(5) 346 | .IsFixedLength() 347 | .HasColumnName("CustomerID"); 348 | entity.Property(e => e.EmployeeId).HasColumnName("EmployeeID"); 349 | entity.Property(e => e.Freight) 350 | .HasDefaultValue(0m) 351 | .HasColumnType("money"); 352 | entity.Property(e => e.OrderDate).HasColumnType("datetime"); 353 | entity.Property(e => e.RequiredDate).HasColumnType("datetime"); 354 | entity.Property(e => e.ShipAddress).HasMaxLength(60); 355 | entity.Property(e => e.ShipCity).HasMaxLength(15); 356 | entity.Property(e => e.ShipCountry).HasMaxLength(15); 357 | entity.Property(e => e.ShipName).HasMaxLength(40); 358 | entity.Property(e => e.ShipPostalCode).HasMaxLength(10); 359 | entity.Property(e => e.ShipRegion).HasMaxLength(15); 360 | entity.Property(e => e.ShippedDate).HasColumnType("datetime"); 361 | 362 | entity.HasOne(d => d.Customer).WithMany(p => p.Orders) 363 | .HasForeignKey(d => d.CustomerId) 364 | .HasConstraintName("FK_Orders_Customers"); 365 | 366 | entity.HasOne(d => d.Employee).WithMany(p => p.Orders) 367 | .HasForeignKey(d => d.EmployeeId) 368 | .HasConstraintName("FK_Orders_Employees"); 369 | 370 | entity.HasOne(d => d.ShipViaNavigation).WithMany(p => p.Orders) 371 | .HasForeignKey(d => d.ShipVia) 372 | .HasConstraintName("FK_Orders_Shippers"); 373 | }); 374 | 375 | modelBuilder.Entity(entity => 376 | { 377 | entity.HasKey(e => new { e.OrderId, e.ProductId }).HasName("PK_Order_Details"); 378 | 379 | entity.ToTable("Order Details"); 380 | 381 | entity.HasIndex(e => e.OrderId, "OrderID"); 382 | 383 | entity.HasIndex(e => e.OrderId, "OrdersOrder_Details"); 384 | 385 | entity.HasIndex(e => e.ProductId, "ProductID"); 386 | 387 | entity.HasIndex(e => e.ProductId, "ProductsOrder_Details"); 388 | 389 | entity.Property(e => e.OrderId).HasColumnName("OrderID"); 390 | entity.Property(e => e.ProductId).HasColumnName("ProductID"); 391 | entity.Property(e => e.Quantity).HasDefaultValue((short)1); 392 | entity.Property(e => e.UnitPrice).HasColumnType("money"); 393 | 394 | entity.HasOne(d => d.Order).WithMany(p => p.OrderDetails) 395 | .HasForeignKey(d => d.OrderId) 396 | .OnDelete(DeleteBehavior.ClientSetNull) 397 | .HasConstraintName("FK_Order_Details_Orders"); 398 | 399 | entity.HasOne(d => d.Product).WithMany(p => p.OrderDetails) 400 | .HasForeignKey(d => d.ProductId) 401 | .OnDelete(DeleteBehavior.ClientSetNull) 402 | .HasConstraintName("FK_Order_Details_Products"); 403 | }); 404 | 405 | modelBuilder.Entity(entity => 406 | { 407 | entity 408 | .HasNoKey() 409 | .ToView("Order Details Extended"); 410 | 411 | entity.Property(e => e.ExtendedPrice).HasColumnType("money"); 412 | entity.Property(e => e.OrderId).HasColumnName("OrderID"); 413 | entity.Property(e => e.ProductId).HasColumnName("ProductID"); 414 | entity.Property(e => e.ProductName).HasMaxLength(40); 415 | entity.Property(e => e.UnitPrice).HasColumnType("money"); 416 | }); 417 | 418 | modelBuilder.Entity(entity => 419 | { 420 | entity 421 | .HasNoKey() 422 | .ToView("Order Subtotals"); 423 | 424 | entity.Property(e => e.OrderId).HasColumnName("OrderID"); 425 | entity.Property(e => e.Subtotal).HasColumnType("money"); 426 | }); 427 | 428 | modelBuilder.Entity(entity => 429 | { 430 | entity 431 | .HasNoKey() 432 | .ToView("Orders Qry"); 433 | 434 | entity.Property(e => e.Address).HasMaxLength(60); 435 | entity.Property(e => e.City).HasMaxLength(15); 436 | entity.Property(e => e.CompanyName).HasMaxLength(40); 437 | entity.Property(e => e.Country).HasMaxLength(15); 438 | entity.Property(e => e.CustomerId) 439 | .HasMaxLength(5) 440 | .IsFixedLength() 441 | .HasColumnName("CustomerID"); 442 | entity.Property(e => e.EmployeeId).HasColumnName("EmployeeID"); 443 | entity.Property(e => e.Freight).HasColumnType("money"); 444 | entity.Property(e => e.OrderDate).HasColumnType("datetime"); 445 | entity.Property(e => e.OrderId).HasColumnName("OrderID"); 446 | entity.Property(e => e.PostalCode).HasMaxLength(10); 447 | entity.Property(e => e.Region).HasMaxLength(15); 448 | entity.Property(e => e.RequiredDate).HasColumnType("datetime"); 449 | entity.Property(e => e.ShipAddress).HasMaxLength(60); 450 | entity.Property(e => e.ShipCity).HasMaxLength(15); 451 | entity.Property(e => e.ShipCountry).HasMaxLength(15); 452 | entity.Property(e => e.ShipName).HasMaxLength(40); 453 | entity.Property(e => e.ShipPostalCode).HasMaxLength(10); 454 | entity.Property(e => e.ShipRegion).HasMaxLength(15); 455 | entity.Property(e => e.ShippedDate).HasColumnType("datetime"); 456 | }); 457 | 458 | modelBuilder.Entity(entity => 459 | { 460 | entity.HasIndex(e => e.CategoryId, "CategoriesProducts"); 461 | 462 | entity.HasIndex(e => e.CategoryId, "CategoryID"); 463 | 464 | entity.HasIndex(e => e.ProductName, "ProductName"); 465 | 466 | entity.HasIndex(e => e.SupplierId, "SupplierID"); 467 | 468 | entity.HasIndex(e => e.SupplierId, "SuppliersProducts"); 469 | 470 | entity.Property(e => e.ProductId).HasColumnName("ProductID"); 471 | entity.Property(e => e.CategoryId).HasColumnName("CategoryID"); 472 | entity.Property(e => e.ProductName).HasMaxLength(40); 473 | entity.Property(e => e.QuantityPerUnit).HasMaxLength(20); 474 | entity.Property(e => e.ReorderLevel).HasDefaultValue((short)0); 475 | entity.Property(e => e.SupplierId).HasColumnName("SupplierID"); 476 | entity.Property(e => e.UnitPrice) 477 | .HasDefaultValue(0m) 478 | .HasColumnType("money"); 479 | entity.Property(e => e.UnitsInStock).HasDefaultValue((short)0); 480 | entity.Property(e => e.UnitsOnOrder).HasDefaultValue((short)0); 481 | 482 | entity.HasOne(d => d.Category).WithMany(p => p.Products) 483 | .HasForeignKey(d => d.CategoryId) 484 | .HasConstraintName("FK_Products_Categories"); 485 | 486 | entity.HasOne(d => d.Supplier).WithMany(p => p.Products) 487 | .HasForeignKey(d => d.SupplierId) 488 | .HasConstraintName("FK_Products_Suppliers"); 489 | }); 490 | 491 | modelBuilder.Entity(entity => 492 | { 493 | entity 494 | .HasNoKey() 495 | .ToView("Product Sales for 1997"); 496 | 497 | entity.Property(e => e.CategoryName).HasMaxLength(15); 498 | entity.Property(e => e.ProductName).HasMaxLength(40); 499 | entity.Property(e => e.ProductSales).HasColumnType("money"); 500 | }); 501 | 502 | modelBuilder.Entity(entity => 503 | { 504 | entity 505 | .HasNoKey() 506 | .ToView("Products Above Average Price"); 507 | 508 | entity.Property(e => e.ProductName).HasMaxLength(40); 509 | entity.Property(e => e.UnitPrice).HasColumnType("money"); 510 | }); 511 | 512 | modelBuilder.Entity(entity => 513 | { 514 | entity 515 | .HasNoKey() 516 | .ToView("Products by Category"); 517 | 518 | entity.Property(e => e.CategoryName).HasMaxLength(15); 519 | entity.Property(e => e.ProductName).HasMaxLength(40); 520 | entity.Property(e => e.QuantityPerUnit).HasMaxLength(20); 521 | }); 522 | 523 | modelBuilder.Entity(entity => 524 | { 525 | entity 526 | .HasNoKey() 527 | .ToView("Quarterly Orders"); 528 | 529 | entity.Property(e => e.City).HasMaxLength(15); 530 | entity.Property(e => e.CompanyName).HasMaxLength(40); 531 | entity.Property(e => e.Country).HasMaxLength(15); 532 | entity.Property(e => e.CustomerId) 533 | .HasMaxLength(5) 534 | .IsFixedLength() 535 | .HasColumnName("CustomerID"); 536 | }); 537 | 538 | modelBuilder.Entity(entity => 539 | { 540 | entity.HasKey(e => e.RegionId).IsClustered(false); 541 | 542 | entity.ToTable("Region"); 543 | 544 | entity.Property(e => e.RegionId) 545 | .ValueGeneratedNever() 546 | .HasColumnName("RegionID"); 547 | entity.Property(e => e.RegionDescription) 548 | .HasMaxLength(50) 549 | .IsFixedLength(); 550 | }); 551 | 552 | modelBuilder.Entity(entity => 553 | { 554 | entity.Property(e => e.Id).HasColumnName("ID"); 555 | entity.Property(e => e.GroupId).HasColumnName("GroupID"); 556 | entity.Property(e => e.IsDeleted) 557 | .HasDefaultValue(false) 558 | .HasColumnName("isDeleted"); 559 | entity.Property(e => e.RoleId).HasColumnName("RoleID"); 560 | entity.Property(e => e.RoleName) 561 | .HasMaxLength(50) 562 | .IsUnicode(false); 563 | 564 | entity.HasOne(d => d.Group).WithMany(p => p.Roles) 565 | .HasForeignKey(d => d.GroupId) 566 | .HasConstraintName("FK_Roles_RoleGroups"); 567 | }); 568 | 569 | modelBuilder.Entity(entity => 570 | { 571 | entity.Property(e => e.Id).HasColumnName("ID"); 572 | entity.Property(e => e.GroupName) 573 | .HasMaxLength(50) 574 | .IsUnicode(false); 575 | entity.Property(e => e.IsDeleted) 576 | .HasDefaultValue(false) 577 | .HasColumnName("isDeleted"); 578 | }); 579 | 580 | modelBuilder.Entity(entity => 581 | { 582 | entity 583 | .HasNoKey() 584 | .ToView("Sales by Category"); 585 | 586 | entity.Property(e => e.CategoryId).HasColumnName("CategoryID"); 587 | entity.Property(e => e.CategoryName).HasMaxLength(15); 588 | entity.Property(e => e.ProductName).HasMaxLength(40); 589 | entity.Property(e => e.ProductSales).HasColumnType("money"); 590 | }); 591 | 592 | modelBuilder.Entity(entity => 593 | { 594 | entity 595 | .HasNoKey() 596 | .ToView("Sales Totals by Amount"); 597 | 598 | entity.Property(e => e.CompanyName).HasMaxLength(40); 599 | entity.Property(e => e.OrderId).HasColumnName("OrderID"); 600 | entity.Property(e => e.SaleAmount).HasColumnType("money"); 601 | entity.Property(e => e.ShippedDate).HasColumnType("datetime"); 602 | }); 603 | 604 | modelBuilder.Entity(entity => 605 | { 606 | entity.Property(e => e.ShipperId).HasColumnName("ShipperID"); 607 | entity.Property(e => e.CompanyName).HasMaxLength(40); 608 | entity.Property(e => e.Phone).HasMaxLength(24); 609 | }); 610 | 611 | modelBuilder.Entity(entity => 612 | { 613 | entity 614 | .HasNoKey() 615 | .ToView("Summary of Sales by Quarter"); 616 | 617 | entity.Property(e => e.OrderId).HasColumnName("OrderID"); 618 | entity.Property(e => e.ShippedDate).HasColumnType("datetime"); 619 | entity.Property(e => e.Subtotal).HasColumnType("money"); 620 | }); 621 | 622 | modelBuilder.Entity(entity => 623 | { 624 | entity 625 | .HasNoKey() 626 | .ToView("Summary of Sales by Year"); 627 | 628 | entity.Property(e => e.OrderId).HasColumnName("OrderID"); 629 | entity.Property(e => e.ShippedDate).HasColumnType("datetime"); 630 | entity.Property(e => e.Subtotal).HasColumnType("money"); 631 | }); 632 | 633 | modelBuilder.Entity(entity => 634 | { 635 | entity.HasIndex(e => e.CompanyName, "CompanyName"); 636 | 637 | entity.HasIndex(e => e.PostalCode, "PostalCode"); 638 | 639 | entity.Property(e => e.SupplierId).HasColumnName("SupplierID"); 640 | entity.Property(e => e.Address).HasMaxLength(60); 641 | entity.Property(e => e.City).HasMaxLength(15); 642 | entity.Property(e => e.CompanyName).HasMaxLength(40); 643 | entity.Property(e => e.ContactName).HasMaxLength(30); 644 | entity.Property(e => e.ContactTitle).HasMaxLength(30); 645 | entity.Property(e => e.Country).HasMaxLength(15); 646 | entity.Property(e => e.Fax).HasMaxLength(24); 647 | entity.Property(e => e.HomePage).HasColumnType("ntext"); 648 | entity.Property(e => e.Phone).HasMaxLength(24); 649 | entity.Property(e => e.PostalCode).HasMaxLength(10); 650 | entity.Property(e => e.Region).HasMaxLength(15); 651 | }); 652 | 653 | modelBuilder.Entity(entity => 654 | { 655 | entity.HasKey(e => e.TerritoryId).IsClustered(false); 656 | 657 | entity.Property(e => e.TerritoryId) 658 | .HasMaxLength(20) 659 | .HasColumnName("TerritoryID"); 660 | entity.Property(e => e.RegionId).HasColumnName("RegionID"); 661 | entity.Property(e => e.TerritoryDescription) 662 | .HasMaxLength(50) 663 | .IsFixedLength(); 664 | 665 | entity.HasOne(d => d.Region).WithMany(p => p.Territories) 666 | .HasForeignKey(d => d.RegionId) 667 | .OnDelete(DeleteBehavior.ClientSetNull) 668 | .HasConstraintName("FK_Territories_Region"); 669 | }); 670 | 671 | modelBuilder.Entity(entity => 672 | { 673 | entity.Property(e => e.Email) 674 | .HasMaxLength(50) 675 | .IsUnicode(false); 676 | entity.Property(e => e.Gsm) 677 | .HasMaxLength(50) 678 | .IsUnicode(false); 679 | entity.Property(e => e.LastName) 680 | .HasMaxLength(50) 681 | .IsUnicode(false); 682 | entity.Property(e => e.Name) 683 | .HasMaxLength(50) 684 | .IsUnicode(false); 685 | entity.Property(e => e.Password) 686 | .HasMaxLength(50) 687 | .IsUnicode(false); 688 | entity.Property(e => e.PasswordHash) 689 | .HasMaxLength(250) 690 | .IsUnicode(false); 691 | entity.Property(e => e.UserName) 692 | .HasMaxLength(50) 693 | .IsUnicode(false); 694 | }); 695 | 696 | modelBuilder.Entity(entity => 697 | { 698 | entity.ToTable("UserAction"); 699 | 700 | entity.Property(e => e.IsDeleted).HasDefaultValue(false); 701 | 702 | entity.HasOne(d => d.IdModuleNavigation).WithMany(p => p.UserActions) 703 | .HasForeignKey(d => d.IdModule) 704 | .HasConstraintName("FK_UserAction_Modules"); 705 | 706 | entity.HasOne(d => d.IdUserNavigation).WithMany(p => p.UserActions) 707 | .HasForeignKey(d => d.IdUser) 708 | .HasConstraintName("FK_UserAction_Users"); 709 | }); 710 | 711 | modelBuilder.Entity(entity => 712 | { 713 | entity.Property(e => e.Id).HasColumnName("ID"); 714 | entity.Property(e => e.RoleGroupId).HasColumnName("RoleGroupID"); 715 | entity.Property(e => e.UserId).HasColumnName("UserID"); 716 | 717 | entity.HasOne(d => d.RoleGroup).WithMany(p => p.UserRoles) 718 | .HasForeignKey(d => d.RoleGroupId) 719 | .HasConstraintName("FK_UserRoles_RoleGroups"); 720 | 721 | entity.HasOne(d => d.User).WithMany(p => p.UserRoles) 722 | .HasForeignKey(d => d.UserId) 723 | .HasConstraintName("FK_UserRoles_Users"); 724 | }); 725 | 726 | modelBuilder.Entity(entity => 727 | { 728 | entity 729 | .HasNoKey() 730 | .ToView("VwCustomerProducts"); 731 | 732 | entity.Property(e => e.CustomerId) 733 | .HasMaxLength(5) 734 | .IsFixedLength() 735 | .HasColumnName("CustomerID"); 736 | entity.Property(e => e.ProductName).HasMaxLength(40); 737 | entity.Property(e => e.ShipCountry).HasMaxLength(15); 738 | entity.Property(e => e.Total).HasColumnType("money"); 739 | entity.Property(e => e.UnitPrice).HasColumnType("money"); 740 | }); 741 | 742 | OnModelCreatingPartial(modelBuilder); 743 | } 744 | 745 | partial void OnModelCreatingPartial(ModelBuilder modelBuilder); 746 | } 747 | --------------------------------------------------------------------------------