MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

Repository Access  (Mono Support )

27354 put(a) pogledan, 3 odgovor(a) 24.3.2016. 11:45:33Kreirao(la) draven
draven

draven

24.3.2016. 11:45:33
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.
Ovaj sadržaj još nije ocijenjen. 
98 Reputacija 8 Ukupno objava
khorvat

khorvat

24.3.2016. 13:31:01
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/.
Ovaj sadržaj još nije ocijenjen. 
15993 Reputacija 2214 Ukupno objava
draven

draven

24.3.2016. 14:34:32
Hi,

Thanks for this, I'll give it a go and come back with any other questions.
Ovaj sadržaj još nije ocijenjen. 
98 Reputacija 8 Ukupno objava