Click here to Skip to main content
15,886,258 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionRe: forum Pin
ZurdoDev2-Feb-15 3:12
professionalZurdoDev2-Feb-15 3:12 
Answerform with html css but I don't know asp Pin
Member 1141563430-Jan-15 10:55
Member 1141563430-Jan-15 10:55 
QuestionWhy should I use Interface type of object in Constructor instead of Actual Class Object Pin
Amy Dev29-Jan-15 0:42
Amy Dev29-Jan-15 0:42 
AnswerRe: Why should I use Interface type of object in Constructor instead of Actual Class Object Pin
Anurag Gandhi29-Jan-15 6:28
professionalAnurag Gandhi29-Jan-15 6:28 
AnswerRe: Why should I use Interface type of object in Constructor instead of Actual Class Object Pin
F-ES Sitecore2-Feb-15 2:32
professionalF-ES Sitecore2-Feb-15 2:32 
GeneralRe: Why should I use Interface type of object in Constructor instead of Actual Class Object Pin
Erik Funkenbusch7-Feb-15 15:38
Erik Funkenbusch7-Feb-15 15:38 
GeneralRe: Why should I use Interface type of object in Constructor instead of Actual Class Object Pin
F-ES Sitecore8-Feb-15 13:08
professionalF-ES Sitecore8-Feb-15 13:08 
AnswerRe: Why should I use Interface type of object in Constructor instead of Actual Class Object Pin
Erik Funkenbusch7-Feb-15 15:52
Erik Funkenbusch7-Feb-15 15:52 
This is a variation of a fairly common way of abstracting your data layer in Unit of Work and Repository patterns.

First, let me say there is nothing "enterprise" about this. It's used in both small, medium and large applications. So anyone that told you this was about enterprise development was feeding you a line.

Second, this particular implementation is a bit heavy on the abstractions.. and could probably be slimed down, but there is basically nothing wrong with it, other than having to maintain all those extra abstractions. (also, depending on who you talk to, some people feel that generic repositories are a bad idea, and an anti-pattern. I'm one of them, but It is a controversial subject).

Third, if you're using Entity Framework as your underlying data model, these abstractions are probably just extra noise since EF already provides these abstractions in the form of your DbContext and DbSet, which are already Unit of Work and Generic Repsitory respectively. You can add interfaces to these to make them more Dependency Injection friendly fairly easily, and as of EF6 they provide mockability so neither DI or Unit testing are good reasons to add the extra abstraction layers anymore. However, some people like the comfort of knowledge that they may want to replace their data layer some day and adding these abstractions (in theory) makes that easier (although in practice it's usually not so simple as these are leaky abstractions which tend to leak into your application layers anyways).

However, having said all that.. if you already have this infrastructure, I wouldn't go ripping it out unless you find it to be too burdensome to maintain.

Now, on to the interfaces... Yes, you absolutely should be using interfaces. For reasons of Unit testing and Dependency Injection, as well interface segregation principle. Using an interface helps decouple your implementation from the contract you use to access it.

It's important to realize that "enterprise architecture" is a lot more than just adding an abstracted data layer. It's creating standards that your enterprise follows, and architecting your suite of applications to work together. It's having an infrastructure or technologies, like Service Busses, or Message Queues and planning redundancy, durability, and failability. In short, it's about seeing the forest and not the trees.
--
Where are we going? And why am I in this handbasket?

QuestionEmbedding Qr code Scanner[Need Guidance] Pin
Member 1140255328-Jan-15 11:32
Member 1140255328-Jan-15 11:32 
AnswerRe: Embedding Qr code Scanner[Need Guidance] Pin
Member 1140255328-Jan-15 17:38
Member 1140255328-Jan-15 17:38 
QuestionAsp.net Pin
Member 1133602728-Jan-15 10:30
Member 1133602728-Jan-15 10:30 
AnswerRe: Asp.net Pin
Richard MacCutchan28-Jan-15 21:21
mveRichard MacCutchan28-Jan-15 21:21 
AnswerRe: Asp.net Pin
Erik Funkenbusch7-Feb-15 15:55
Erik Funkenbusch7-Feb-15 15:55 
AnswerRe: Asp.net Pin
Rahul Rajat Singh13-Feb-15 0:32
professionalRahul Rajat Singh13-Feb-15 0:32 
QuestionHow to retrieve multiple values from a single SELECT statement? Pin
samflex28-Jan-15 7:02
samflex28-Jan-15 7:02 
AnswerRe: How to retrieve multiple values from a single SELECT statement? Pin
PIEBALDconsult28-Jan-15 7:09
mvePIEBALDconsult28-Jan-15 7:09 
GeneralRe: How to retrieve multiple values from a single SELECT statement? Pin
samflex28-Jan-15 7:15
samflex28-Jan-15 7:15 
GeneralRe: How to retrieve multiple values from a single SELECT statement? Pin
PIEBALDconsult28-Jan-15 7:26
mvePIEBALDconsult28-Jan-15 7:26 
GeneralRe: How to retrieve multiple values from a single SELECT statement? Pin
samflex28-Jan-15 7:32
samflex28-Jan-15 7:32 
GeneralRe: How to retrieve multiple values from a single SELECT statement? Pin
PIEBALDconsult28-Jan-15 7:41
mvePIEBALDconsult28-Jan-15 7:41 
AnswerRe: How to retrieve multiple values from a single SELECT statement? Pin
F-ES Sitecore2-Feb-15 2:29
professionalF-ES Sitecore2-Feb-15 2:29 
QuestionMultiple popups using JavaScript Pin
Nav_god27-Jan-15 1:49
Nav_god27-Jan-15 1:49 
SuggestionRe: Multiple popups using JavaScript Pin
Kornfeld Eliyahu Peter27-Jan-15 2:00
professionalKornfeld Eliyahu Peter27-Jan-15 2:00 
AnswerRe: Multiple popups using JavaScript Pin
Member 1050600328-Jan-15 1:09
Member 1050600328-Jan-15 1:09 
AnswerRe: Multiple popups using JavaScript Pin
Nav_god28-Jan-15 3:46
Nav_god28-Jan-15 3:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.