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<>));
This comment has been removed by the author.
ReplyDeleteThank you, saved my day.
ReplyDelete