I have read many topics on stackoverflow but I still don't know what kind of object I should pass from DAL to BLL if I need to create custom type.
In DAL I have an entity:
public class Note
{
[Key]
public int NoteId { get; set; }
[Required]
[Column(TypeName = "varchar(MAX)")]
public string Content { get; set; }
public DateTime CreatedDate { get; set; }
public DateTime ModifiedDate { get; set; }
public virtual ICollection<Comment> Comments { get; set; }
}
But I need to return to BLL only: NoteId, Content and number of comments which aren't spam so in DAL I have a query:
public IEnumerable<WhatIsIt> GetNotesWithNoSpamCommentsCount()
{
var whatIsIt = context.Notes.Select(x =>
new WhatIsIt
{
NoteId = x.NoteId,
NoteSummary = x.Content,
NoteCommentsCount = x.Comments.Where(y => y.IsSpam == false).Count()
}).ToList();
return whatIsIt;
}
What kind of object is it which I return - is it Data Access Object or Model or Data Transfer Object or Business Object or something else?
Aucun commentaire:
Enregistrer un commentaire