Я хочу написать API с методом репозитория, где одна таблица сущностей содержит адрес трех сущностей.
Вот таблица отношений сущностей:
public partial class Addresses
{
public Guid Id { get; set; }
public Guid? SchoolHeadOfficeId { get; set; }
public Guid? SchoolsId { get; set; }
public Guid? UserId { get; set; }
}
Мой IRespository похож на это:
public interface IAddressesRepositry
{
Task<Addresses> GetAllAddressesByUSerIdAsync(Guid Id);
Task<Addresses> CreateAddressesAsync(Addresses addresses);
}
и я хочу делать вещи в своем хранилище Класс:
public class AddressesRepositry : IAddressesRepositry
{
learning_gpsContext _learning_GpsContext = null;
public AddressesRepositry(learning_gpsContext context)
{
_learning_GpsContext = context;
}
public Task<Addresses> GetAllAddressesByIdAsync(Guid SchoolHeadOfficeId , Guid SchoolsId, Guid UserId)
{
Addresses var = await _learning_GpsContext.Addresses.where(x => x.SchoolHeadOfficeId == schoolsystemId |or| SchoolsId==SchoolsId |or| UserId==UserId ) //here i will be unable to understand which
//type code can write to get data on the basis of any one id
}
}