last day (15 days later) » 

15:37
2
A: 3 tier architecture ado.net application

Mat's MugThe only thing I'd say about your repository, is that GetAll shouldn't return an IList<T>, but an IEnumerable<T>. And you're probably missing a method like GetById that returns only a single record - right now the only way to fetch a single student is... to fetch them all and then filter in memor...

Thanks! If I need to move the connection string to a common place, so that the connection string is initialised only once, how could I do that? Masterpage code behind or App code or in Global asax?
Putting it in the master page will initialize it once per request - putting it in global.asax will initialize it once in the app's lifetime. You decide ;)
I need it to be there in global.asax but how can I pass it from global.asax to my implementation while I access any method like FindALL() ?
Also I believe, I've implemented Repository pattern through Interfaces and Dependency Injection through StudentRepository constructor. Correct me if I am wrong
In ASP.NET MVC you could make the global setting a constructor argument for your controllers. I'd have to relook at the chapter about ASP.NET in Dependency Injection in .NET to see how DI works with ASP.NET, but if I remember correctly your composition root is at the page level and you have to work around that (I don't think you can control a page's constructor parameters), so you're probably better off composing your dependencies in the master page's code-behind.
Sorry if this is back-and-forth.. I don't do ASP.NET very often ;)
@TechJerk hi!
hi
@Mat'sMug Not a problem, I am just trying to learn the ways to design a application using patterns :)
15:39
that's cool
don't fall into the trap of blind pattern-making :) I often see people wrap EF with a unit-of-work + repository pattern, ...kills me ;)
have you read this book?
By now my goal is to develope a web application that implements repository pattern to fetch data from DB. I am not much concerned whether it is MVC or EF since I have good experience in asp.net I tried this design
when you say MVC, you mean model-view-controller right? has nothing to do with EF
yes, I do understand that, I just let you know I am open to use any tools available
MVC is quite a shift from ASP.NET :)
and if your goal is to build a web app with a repository pattern, merely using EF instead of ADO.NET will do that.
yes, I just did a couple of simple programs in MVC to understand how it works. Though I understand how controller, model works, the razor code is bit difficult to understand. I will work on that sooner
EF with code first?
15:47
for EF vs repository, check this out: wekeroad.com/2014/03/04/…
always code first :)
can you help me to find a quick simple tutorial on EF? I would love to work on that immediately
if you have your own Student class already, all you're missing is a class that derives from DbContext:
public class Context: DbContext
    {
        public Context(): base()
        {

        }
        public DbSet<Student> Students { get; set; }
        public DbSet<Standard> Standards { get; set; }
    }
EF works a lot by convention over configuration, so if there's a property in Student that's called Id, EF will automagically map it to the entity's key.
Exactly I am look the same tut :) thank a lot!
16:03
now you'll want to be able to access Context via an abstraction, so that your controllers don't directly depend on a DbContext - that's why people wrap EF with a unit-of-work and repository pattern, but they're killing a fly with a bazooka. All you really need is for Context to implement some IUnitOfWork and expose a method to save changes / commit, and then a generic method to get the dbset for a given entity type. rest is implementation details ;)

last day (15 days later) »