IRepository and IcontentManager

Topics: Core, Customizing Orchard, General, Troubleshooting, Writing modules
Dec 5, 2012 at 7:47 AM

I have ageneral question,

what is the difference between Irepository and IContentManager and

when is it best to inject and use each?


Thhank you :)))

Dec 5, 2012 at 4:06 PM

IContentManager is a high-level service where you can do CRUD operations and various other ones on content items (as you may know content items are a bit complex composite objects, containing among others parts). IRepository<TRecord> on the other hand is a much lower-level service for accessing records, i.e. database tables.

So if you deal with content items, use IContentManager. If you deal with records directly (and thus you most possibly don't deal with content items) use IRepository.

Dec 6, 2012 at 8:18 AM

Thanks :))