Reputation: 1362
Hello suppose I am using Entity Framework Core and have some classes like:
class A {
public Guid Id {get; set;}
public string PropA { get; set;}
}
class B {
public Guid Id {get; set;}
public int PropB { get; set;}
}
class C {
public Guid Id {get; set;}
public DateTime PropC {get; set;}
}
class Log {
public Guid Id {get; set;}
public Guid ObjectId {get; set;}
public DateTime UpdateDate {get; set;}
}
Where class Log will store the class A B C's Id to field ObjectId.
What I want to achieve is to retrieve rows of A/B/C which updated after specific date time. I come up in mind to edit the classes by adding
List<Log>
to the classes like:
class A {
public Guid Id {get; set;}
public string PropA { get; set;}
public List<Log> Log { get; set;}
}
But I don't know whether it is correct. Is this the proper way to model such relationship? Thanks.
Upvotes: 1
Views: 125
Reputation: 65860
I cannot see any implementation issues on the above use case.But you have to use naming conversions properly when you named the properties.
Here is the issue on list naming.
BAD : public List<Log> Log { get; set;}
BEST : public List<Log> Logs { get; set;}
Upvotes: 1