Mono Support Repository Access 

Viewed 27196 time(s), 3 post(s), 3/24/2016 11:45:33 AM - by draven
3/24/2016 11:45:33 AM
98 Reputation 8 Total posts

Hi.

I'm pretty sure that I am doing something stupid here but I'm really struggling to write custom code that makes use of the repositories. I'm following code snippets from the documentation and support forum but anything similar to this

blog.ApplicationId = MembershipRepository.GetInstance().GetApplicationId();

or this

BlogRepository.GetInstance().SaveBlog(blog, string.Empty);

results in compilation errors of:

Error 4 'MonoSoftware.MonoX.Repositories.MembershipRepository' does not contain a definition for 'GetInstance'

Error 5 'MonoSoftware.MonoX.Repositories.BlogRepository' does not contain a definition for 'GetInstance' 

Are you able to point me in the right direction?

Thanks.

1
3/24/2016 1:31:01 PM
15993 Reputation 2214 Total posts

Hi,

you are probably using code samples from v4.x and running them against v5.x. MonoX v5 had DI architecture s you need to inject or resolve MembershipRepository or BlogRepository and not use GetInstance. You can start by reading the following article which has few guidelines for using DI in MonoX http://monox.mono-software.com/Blog/post/Mono/246/MonoX-CMS-upgrade-guidelines-v4-9-to-v5-1/.

2
3/24/2016 2:34:32 PM
98 Reputation 8 Total posts

Hi,

Thanks for this, I'll give it a go and come back with any other questions.

3
This is a demo site for MonoX. Please visit Mono Software for more info.