Saturday, October 1, 2011

Autofac and the Generic Repository Pattern

The Generic repository pattern is useful when you want to quickly get a site persisting its data elements without a lot of customization. Here is how I use the Generic Repository pattern (using MongoDB) with Dependency Injection (via Autofac).
builder.RegisterGeneric(typeof(MongoRepository<>))
    .WithParameter(new NamedParameter("connectionString", connectionString))
    .As(typeof(IRepository<>));

5 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. Delighted beyond expectations with the incredible results from droidkit during my data recovery journey. The software performed flawlessly and restored files I thought were permanently lost. Its ease of use and effectiveness make it one of the best available tools.

    ReplyDelete
  3. Impeccably praises this outstanding professional website 120426938 delivers excellent user experience with fast navigation clean layout engaging content reliable performance modern design intuitive structure and helpful resources that truly satisfy visitors expectations across all devices consistently every single time impressively

    ReplyDelete
  4. Keen shows great quality platform 120995459 delivers exceptional user experience with smooth navigation intuitive design valuable content fast loading pages reliable performance modern structure helpful resources engaging interface consistent updates and professional presentation making it highly recommended platform for visitors

    ReplyDelete