Reputation
729
Top tag
Next privilege 1,000 Rep.
See votes, expandable usercard
Badges
1 7 17
Impact
~57k people reached

  • 0 posts edited
  • 1 helpful flag
  • 35 votes cast
Apr
28
awarded  Notable Question
Feb
24
accepted Would dependency injecting into entites be considered against SRP?
Feb
23
comment Would dependency injecting into entites be considered against SRP?
Upvote for your edit, I was avoiding the anemic domain model anti-pattern. I also agree a derived type is much better than the id
Feb
23
comment Would dependency injecting into entites be considered against SRP?
Excellent points, Thanks
Feb
23
comment Would dependency injecting into entites be considered against SRP?
Great input, it would be a better solution to have a derived type with overridden validation method than having a type id property and using an injected factory. The reason for the factory check in the validate method and not constructor was I don't want an exception for selects. If the data is just being read I don't care if the function is unavailable. I agree it is a smell though.
Feb
23
comment Would dependency injecting into entites be considered against SRP?
@Euphoric having been away from it for a short while and looked back, you are correct about the TypeId, a derived type would have been a better solution and the validation could have been overridden to be specific to that entity.
Feb
23
comment Would dependency injecting into entites be considered against SRP?
@Euphoric In this instance, the one entity is needed. The properties are identical just some different business/industry rules. The data needs to be concat and sortable so having the same type assists that. I do takwe your point that if not of the mentioned requirement it would be much better to have the 4 entities. However, altho no factory would be needed it would still make sense to have the validator injected so it can be extended/changed in the future without changing the client.
Feb
23
revised Would dependency injecting into entites be considered against SRP?
added 304 characters in body
Feb
23
asked Would dependency injecting into entites be considered against SRP?
Dec
7
awarded  Famous Question
Oct
29
awarded  Notable Question
Oct
25
awarded  Notable Question
Oct
7
awarded  Notable Question
Aug
19
accepted Unit Testing without DI
Aug
19
comment Unit Testing without DI
My initial thought was wasted resources with items being instantiated that may not be used by the method being called but I do agree the effect it has on unit testing is too great. Looks like I am backtracking. Thanks all for input
Aug
18
comment Unit Testing without DI
I think a system can not use DI and not be badly designed. However, I think it may be worth adding it so I can properly test my controllers.
Aug
18
comment Unit Testing without DI
Well, in retrospect I would probably set up a DI container and use that. I had it in my head that DI setup was not worth the time on small projects. I am just looking to see if there is an alternative without implementing one (reversing the decision)
Aug
18
asked Unit Testing without DI
Aug
10
comment Is that good idea to add ViewModel exactly same as Model
Sounds like it would be open to mass assignment attacks
Jun
4
comment What are my options for exposing customization settings to the admin user?
I have written a few corporate apps in ASP.NET 3/4/5 and they all required some kind of configuration. Having an admin page updating database stored settings, which are then used across the site where required is the best option. You have backups of the database etc and can access your config options as entities in the application.