Upgrading 1.9.6 to SA 2 and managing repositories

29 views
Skip to first unread message

Matt

unread,
Jun 16, 2013, 6:19:38 AM6/16/13
to sharp-arc...@googlegroups.com
Its finally had to happen. I'd tried to avoid it but I knew it would have to happen some day and it turns out I have to upgrade to SA 2 before I can use SA in Windows Azure (because of the necessity for the connection retries but that's getting off topic). 

I've bitten the bullet and I've used NuGet to update all my 1.9.6 references and changed my namespaces to bring Core over to Domain and Data over to Infrastructure. I have legacy code in ApplicationServices which I really need to keep and this is where my problems are starting because it is all about the repositories. Where before, in 1.9.6, we had IRepository that had everything on it, it seems that IRepository has had some things removed and ILinqRepository added such that the old repository methods are now split across these two classes.

So I've been updating my repositories to inherit from both ILinqRepository and IRepository but this gives me a nasty ambiguous call issue for the delete method because that exists on both interfaces. I can fix this but its not pretty and will be time consuming putting all those casts in. I'm interested to know whether anyone has any recommendations? I've tried to use only ILinqRepository as this looks much more useful however it does not have a DbContext. Deriving from only IRepository means I lack too many useful methods. 

Craig van Nieuwkerk

unread,
Jun 16, 2013, 6:23:00 AM6/16/13
to sharp-arc...@googlegroups.com
Although it won't help you in the upgrade, I have gotten Retry to work in 1.9.6 running on Azure. What could you not get working?


--
You received this message because you are subscribed to the Google Groups "S#arp Architecture" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sharp-architect...@googlegroups.com.
To post to this group, send email to sharp-arc...@googlegroups.com.
Visit this group at http://groups.google.com/group/sharp-architecture.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Matt

unread,
Jun 16, 2013, 7:21:17 AM6/16/13
to sharp-arc...@googlegroups.com
Interesting...I may have given up prematurely. I tried two:

First of all, Rob's looks good - https://github.com/robdmoore/NHibernate.SqlAzure but this relies on a newer version of NHibernate and I couldn't downgrade his code.

Then I tried Craig's https://github.com/craigvn/NHibernateRetryable which looks nice and simple however that relies on a newer NHibernate too.

So at this point I thought that this was telling me something and that I should upgrade SA. I'd really appreciate some insight into how you got 1.9.6 to retry connections

Thanks
Matt

On Sunday, June 16, 2013 11:23:00 AM UTC+1, Craig wrote:
Although it won't help you in the upgrade, I have gotten Retry to work in 1.9.6 running on Azure. What could you not get working?
On Sun, Jun 16, 2013 at 8:19 PM, Matt <matt...@gmail.com> wrote:
Its finally had to happen. I'd tried to avoid it but I knew it would have to happen some day and it turns out I have to upgrade to SA 2 before I can use SA in Windows Azure (because of the necessity for the connection retries but that's getting off topic). 

I've bitten the bullet and I've used NuGet to update all my 1.9.6 references and changed my namespaces to bring Core over to Domain and Data over to Infrastructure. I have legacy code in ApplicationServices which I really need to keep and this is where my problems are starting because it is all about the repositories. Where before, in 1.9.6, we had IRepository that had everything on it, it seems that IRepository has had some things removed and ILinqRepository added such that the old repository methods are now split across these two classes.

So I've been updating my repositories to inherit from both ILinqRepository and IRepository but this gives me a nasty ambiguous call issue for the delete method because that exists on both interfaces. I can fix this but its not pretty and will be time consuming putting all those casts in. I'm interested to know whether anyone has any recommendations? I've tried to use only ILinqRepository as this looks much more useful however it does not have a DbContext. Deriving from only IRepository means I lack too many useful methods. 

--
You received this message because you are subscribed to the Google Groups "S#arp Architecture" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sharp-architecture+unsub...@googlegroups.com.

Craig van Nieuwkerk

unread,
Jun 16, 2013, 7:26:43 AM6/16/13
to sharp-arc...@googlegroups.com
Yes, I had to upgrade to a newer version of NHibernate as well. That was a bit of stuffing around, basically getting all the SharpArch source, updating all the references and recompiling. I think I needed to do a few binding redirects as well. So it is possible, but if you reckon you can upgrade to 2.0 I would go that route. 


To unsubscribe from this group and stop receiving emails from it, send an email to sharp-architect...@googlegroups.com.

Matt

unread,
Jun 16, 2013, 9:08:40 AM6/16/13
to sharp-arc...@googlegroups.com
Ok, it's good to know that thanks.

I'll answer my own question. NHibernateRepository<T> is the one to derive from on the repository classes and on the repository interfaces it is INHibernateRepository<T> I was looking at the WhoCanHelpMe app and should have been looking to the Northwind example solution instead.

Does anyone like doing the QuerySpecification thing in WhoCanHelpMe? Is that useful to anyone? I don't know that much about the pattern but it looks complicated at first glance and not sure I fully understand why.

Thanks
Matt

On Sunday, June 16, 2013 12:26:43 PM UTC+1, Craig wrote:
Yes, I had to upgrade to a newer version of NHibernate as well. That was a bit of stuffing around, basically getting all the SharpArch source, updating all the references and recompiling. I think I needed to do a few binding redirects as well. So it is possible, but if you reckon you can upgrade to 2.0 I would go that route. 
On Sun, Jun 16, 2013 at 9:21 PM, Matt <matt...@gmail.com> wrote:
Interesting...I may have given up prematurely. I tried two:

First of all, Rob's looks good - https://github.com/robdmoore/NHibernate.SqlAzure but this relies on a newer version of NHibernate and I couldn't downgrade his code.

Then I tried Craig's https://github.com/craigvn/NHibernateRetryable which looks nice and simple however that relies on a newer NHibernate too.

So at this point I thought that this was telling me something and that I should upgrade SA. I'd really appreciate some insight into how you got 1.9.6 to retry connections

Thanks
Matt

On Sunday, June 16, 2013 11:23:00 AM UTC+1, Craig wrote:
Although it won't help you in the upgrade, I have gotten Retry to work in 1.9.6 running on Azure. What could you not get working?
On Sun, Jun 16, 2013 at 8:19 PM, Matt <matt...@gmail.com> wrote:
Its finally had to happen. I'd tried to avoid it but I knew it would have to happen some day and it turns out I have to upgrade to SA 2 before I can use SA in Windows Azure (because of the necessity for the connection retries but that's getting off topic). 

I've bitten the bullet and I've used NuGet to update all my 1.9.6 references and changed my namespaces to bring Core over to Domain and Data over to Infrastructure. I have legacy code in ApplicationServices which I really need to keep and this is where my problems are starting because it is all about the repositories. Where before, in 1.9.6, we had IRepository that had everything on it, it seems that IRepository has had some things removed and ILinqRepository added such that the old repository methods are now split across these two classes.

So I've been updating my repositories to inherit from both ILinqRepository and IRepository but this gives me a nasty ambiguous call issue for the delete method because that exists on both interfaces. I can fix this but its not pretty and will be time consuming putting all those casts in. I'm interested to know whether anyone has any recommendations? I've tried to use only ILinqRepository as this looks much more useful however it does not have a DbContext. Deriving from only IRepository means I lack too many useful methods. 

--
You received this message because you are subscribed to the Google Groups "S#arp Architecture" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sharp-architecture+unsubscribe@googlegroups.com.
To post to this group, send email to sharp-arc...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages