I have the following code in C# doing some inner join
public class Complaints : BaseDomainModel
{
public string CaseNumber { get; set; }
public int ClassificationId { get; set; }
public int PriorityId { get; set; }
public bool Anonymous { get; set; }
public int StatusId { get; set; }
public int ReferralChannelId { get; set; }
public DateTime EntryDate { get; set; }
public DateTime EntryDateManagement { get; set; }
public virtual Parameter Classification { get; set; }
public virtual Parameter Priority { get; set; }
public virtual Parameter Status { get; set; }
public virtual Parameter ReferralChannel { get; set; }
}
public class ComplaintsRequeriments : BaseDomainModel
{
public int ComplaintsId { get; set; }
public string Requeriments { get; set; }
public int TypeId { get; set; }
public virtual Parameter Type { get; set; }
public virtual Complaints Complaints { get; set; }
}
public class ComplaintPerson : BaseDomainModel
{
public int PeopleId { get; set; }
public int ComplaintsId { get; set; }
public int TypePersonId { get; set; }
public People People { get; set; }
public Complaints Complaints { get; set; }
public Parameter TypePerson { get; set; }
}
public class Parameter : BaseDomainModel
{
public int ParameterTypeId { get; set; }
public string Value{ get; set; }
public virtual ParameterType ParameterType { get; set; }
}
public class People : BaseDomainModel
{
public int DocumentTypeId { get; set; }
public string Number { get; set; }
public string Name { get; set; }
public string Surnames { get; set; }
public virtual Parameter DocumentType { get; set; }
}
public class User : BaseDomainModel
{
public int PermissionId { get; set; }
public string Email { get; set; }
public string Name { get; set; }
public string Surnames { get; set; }
public int? ImageUploadId { get; set; }
public virtual Permission Permission { get; set; }
public virtual FileUpload? ImageUpload { get; set; }
public virtual ICollection<RequestAssignment> Assignments{ get; set;}
}
GetAllById
public IQueryable<TEntity> GetAllById(Expression<Func<TEntity, bool>> predicate,
bool withTracking = false, bool withSplitedQuery = false)
{
var query = _dbset.AsQueryable().Where(predicate);
if (withSplitedQuery) query = query.AsSplitQuery();
else query = query.AsSingleQuery();
if (withTracking) return query.AsTracking();
return query.AsNoTracking();
}
Join
var r = _unitofwork.Complaints.GetAllById(a => !a.DeletedRecord, true, true).ToList()
.Join(_unitofwork.IComplaintsRequeriments.GetAllById(a => !a.DeletedRecord, true, true).ToList()
, Complaints => Complaints.Id, Requeriments => Requeriments.ComplaintsId
, (Complaints, Requeriments) => new
{
Complaints,
Requeriments
})
.Join(_unitofwork.ParameterRepositories.GetAllById(a => !a.DeletedRecord, true, true).ToList()
, Requeriments => Requeriments.Requeriments.TypeId, ParameterRepositories => ParameterRepositories.Id
, (Requeriments, ParameterRepositories) => new
{
Requeriments,
ParameterRepositories
})
.GroupJoin(_unitofwork.ComplaintPerson.GetAllById(a => !a.DeletedRecord, true, true).ToList()
, Person => Person.Requeriments.Complaints.Id, ComplaintPerson => ComplaintPerson.ComplaintsId
, (Person, ComplaintPerson) => new
{
Person,
ComplaintPerson
})
.Join(_unitofwork.IPeople.GetAllById(a => !a.DeletedRecord, true, true).ToList(),
personUser => personUser.ComplaintPerson.Select(a => a.PeopleId), user => user.Id
,(personUser, user) => new
{
personUser,
user
});
Severity Code Description Project File Line Suppression State
Error CS0411 The type arguments for method 'Enumerable.Join<TOuter, TInner, TKey, TResult>(IEnumerable<TOuter>, IEnumerable<TInner>, Func<TOuter, TKey>, Func<TInner, TKey>, Func<TOuter, TInner, TResult>)' cannot be inferred from the usage. Try specifying the type arguments explicitly. Application C:\Users\asbel\Desktop\RepositoryDGII\Backend\DDD.Application\Features\Complaints\AdminInputFlag\Querys\AdminInputFlag\AdminInputFlagHandler.cs 59 Active
I hope to bring the different join and group join of the different models
Aucun commentaire:
Enregistrer un commentaire