InstantAPIs
InstantAPIs copied to clipboard
IModel
It might be nice if the user was allowed to inherit their model from an IModel
interface that looked something like this:
interface IModel
{
int/Guid Id { get; set;}
}
This would allow the code not to have to use the Type.GetProperty()
method and provide more IntelliSense.
As we're working with entities I would go with:
public interface IEntity { }
public interface IEntity<TId> : IEntity
{
public TId Id { get; set; }
}
Also pretty sure you can derive your model from that interface and it should just work in it's current form.
Sure, that would be better.
Thinking this through... if this interface was implemented by a class and a collection, how do you see this applying to the APIs?
This feels like it plays in the same space as the #4 Repository support.
Thoughts?
Yeah I would agree this kind of falls into repository pattern territory
Yeah, I think this is the same thing as Repository support. This (or repository support) would allow the client/user to get a compilation error if their Model does not contain an Id
property rather than getting an exception thrown during Type.GetProperty()
.