Язык программирования C#9 и платформа .NET5 - Троелсен Эндрю
На нашем сайте KnigaRead.com Вы можете абсолютно бесплатно читать книгу онлайн Троелсен Эндрю, "Язык программирования C#9 и платформа .NET5" бесплатно, без регистрации.
.IgnoreQueryFilters() .Where(x => x.Id == id) .Include(m => m.MakeNavigation) .FirstOrDefault();Добавьте метод, который позволяет получить значение
PetNamepublic string GetPetName(int id){ var parameterId = new SqlParameter { ParameterName = "@carId", SqlDbType = SqlDbType.Int, Value = id, }; var parameterName = new SqlParameter { ParameterName = "@petName", SqlDbType = SqlDbType.NVarChar, Size = 50, Direction = ParameterDirection.Output }; _ = Context.Database .ExecuteSqlRaw("EXEC [dbo].[GetPetName] @carId, @petName OUTPUT", parameterId, parameterName); return (string)parameterName.Value;}Хранилище данных о кредитных рисках
Откройте файл класса
CreditRiskRepo.csusingusing AutoLot.Dal.EfStructures;using AutoLot.Dal.Models.Entities;using AutoLot.Dal.Repos.Base;using AutoLot.Dal.Repos.Interfaces;using Microsoft.EntityFrameworkCore;Измените класс на
publicBaseRepo<CreditRisk>ICreditRiskReponamespace AutoLot.Dal.Repos{ <b>public</b> class CreditRiskRepo : <b>BaseRepo<CreditRisk>, ICreditRiskRepo</b> { public CreditRiskRepo(ApplicationDbContext context) : base(context) { } internal CreditRiskRepo( DbContextOptions<ApplicationDbContext> options) : base(options) { } }}Хранилище данных о заказчиках
Откройте файл класса
CustomerRepo.csusingusing System.Collections.Generic;using System.Linq;using AutoLot.Dal.EfStructures;using AutoLot.Dal.Models.Entities;using AutoLot.Dal.Repos.Base;using AutoLot.Dal.Repos.Interfaces;using Microsoft.EntityFrameworkCore;Измените класс на
publicBaseRepo<Customer>ICustomerReponamespace AutoLot.Dal.Repos{ <b>public</b> class CustomerRepo : <b>BaseRepo<Customer>, ICustomerRepo</b> { public CustomerRepo(ApplicationDbContext context) : base(context) { } internal CustomerRepo( DbContextOptions<ApplicationDbContext> options) : base(options) { } }}Наконец, добавьте метод, который возвращает все записи
CustomerLastNamepublic override IEnumerable<Customer> GetAll() => Table .Include(c => c.Orders) .OrderBy(o => o.PersonalInformation.LastName);Хранилище данных о производителях
Откройте файл класса
MakeRepo.csusingusing System.Collections.Generic;using System.Linq;using AutoLot.Dal.EfStructures;using AutoLot.Dal.Models.Entities;using AutoLot.Dal.Repos.Base;using AutoLot.Dal.Repos.Interfaces;using Microsoft.EntityFrameworkCore;Измените класс на
publicBaseRepo<Make>IMakeRepo