I have applied the repository pattern in my application. The I interface is as follows:
public Interface IRAPSorporation & lt; T & gt; Where T: Square {Enter Zero (T unit); Zero removal (t organization); IEnumerable GetAll (); // More ...}
The default implementation of the repository is on, so if I want to consume my service with a repository (which is already like an API in DDL I do this:
var uService = new UserService (new EFRipitori & lt; user & gt; (new theme ());
My position is that there is a model that will need to add a new property called status
to that model, but it only Is for a customer . That property will not need to be present for others.
I did this:
class MyCustomModel: Users {get the public int status { Set;} // new property} // meanwhile the user service service in the second category * new user service (new EFRipository & lt; MyCustomModel & gt; (new theme ());
But 2 things happend:
-
Since
UserService
requires a type of repositoryuser < / Code> will fail, because the model is not expected
user
. -
If something went wrong and worked and no type of model was changed
UserService
, new service should not be seen in the implementation of user service Because the model is stilluser
-
DDL has already been developed and I want to add a new DBset in database context. Using the EF repository due to only one clinic t.
-
I would like to avoid the fact that I have to add a new property to the user model only because (again), a client.
UserService
Already iraforex Users & gt;
Implementation has changed and that will be for MyCustomModel. I have needed a lot of time in all those cases which I have mentioned.
Is there another way (like other patterns) to solve this situation? Am I doing something wrong?
I tried but I can not see anyway that I can work with it.
Anything will be appreciated.
No comments:
Post a Comment