Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
S#arp Architecture upgraded to ASP.NET MVC Preview 3

S#arp Architecture has been upgraded for compatibility with ASP.NET MVC Preview 3 and Spring.NET 1.1.2..  A big thanks goes out to Adam Cooper and Frank Laub for assisting with this effort.  S#arp Architecture, an architectural framework for developing applications with ASP.NET MVC, Spring.NET and NHibernate, may be found at http://www.codeplex.com/SharpArchitecture.

Billy McCafferty


Posted 06-09-2008 11:34 PM by Billy McCafferty

[Advertisement]

Comments

alexandr wrote re: S#arp Architecture upgraded to ASP.NET MVC Preview 3
on 06-10-2008 8:51 AM

int  x1,x2;

int z1,z2;

x1/z1=x2/z2;

cout<<"1"<<endl;

cout<"0"<<endl;

Steve Gentile wrote re: S#arp Architecture upgraded to ASP.NET MVC Preview 3
on 06-10-2008 7:10 PM

Thanks for the update Billy

Luis Abreu wrote re: S#arp Architecture upgraded to ASP.NET MVC Preview 3
on 06-13-2008 7:36 AM

Hello again Billy.

I've got one more question regarding your implementation of the Equals method in the PersistentObjectWithTypeId. In the current release, you have something like this:

public override sealed bool Equals(object obj) {

           PersistentObjectWithTypedId<IdT> compareTo = obj as PersistentObjectWithTypedId<IdT>;

           return (compareTo != null) &&

                  (HasSameNonDefaultIdAs(compareTo) ||

               // Since the IDs aren't the same, either of them must be transient to

               // compare business value signatures

                   (((IsTransient()) || compareTo.IsTransient()) &&

                    HasSameBusinessSignatureAs(compareTo)));

       }

I'm having some problems on agreeing with this part:

(((IsTransient()) || compareTo.IsTransient())

You'll end up comparing business IDs if any of the objects is transient. Is this really a good idea when you think about NHibernate? Here's a quick example. Suppose you've got  a service that contains a list of items you're going to save to the db. The service has a method that receives objects and adds them to an internal list untill a specific time, and then it will simply call SaveOrUpdate over all those items. It's not really a reallistic example, but lets assume that it will only save the items on the list from30 to 30 seconds.

Now lets also assume that the service ends up receiving two objects of the same type, A and B. A is transient; B is not. BOth have the same business signature (this is not something that happens often, but I've seen in the past).  

Lets also say that adding an item to the "saving list" is only possible if the item isn't there already (and this is done by calling the equals method over each element on the list).

When the service receives A (the transient object) we add it to the list since there isn't any item with the same siganture there. After receiving B (non transient, ie, it has already been persisted on the db), we call Equals over all other elements to see if there's any item on the list. With the previous implementation of equals, we'll get true so this means that B won't be added to the list.

Now, if when I save all the items on the DB i call the SaveOrUpdate method, I'll end up duplicating elements, each one with a different ID.

What I'm saying is that the business comparison should only be allowed if both objects are transient.

What do you think?

The ASP.NET MVC Information Portal wrote The ASP.NET MVC Information Portal
on 06-18-2008 3:38 PM

Pingback from  The ASP.NET MVC Information Portal

Mike wrote re: S#arp Architecture upgraded to ASP.NET MVC Preview 3
on 07-23-2008 10:21 AM

Hello Billy,

I'm using the S#arp Architecture for an inhouse system at work and It's working out great!

Will the current version work with preview 4 as is? or do you have an update in the works?

Thanks!

Mike

Billy McCafferty wrote re: S#arp Architecture upgraded to ASP.NET MVC Preview 3
on 07-27-2008 3:13 PM

I'll likely be publishing an update later this evening, thanks for the interest.

Billy

bookmarks wrote re: S#arp Architecture upgraded to ASP.NET MVC Preview 3
on 03-14-2013 2:54 PM

hRBJqs Thanks so much for the post.Really thank you! Want more.

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Subscribe
Google Reader or Homepage

del.icio.us CodeBetter.com Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl CodeBetter.com Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of Devlicio.us
Red-Gate Tools For SQL and .NET

NDepend

SlickEdit
 
SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
LiteAccounting.Com
DevExpress
Fixx
NHibernate Profiler
Unfuddle
Balsamiq Mockups
Scrumy
JetBrains - ReSharper
Umbraco
NServiceBus
RavenDb
Web Sequence Diagrams
Ducksboard<-- NEW Friend!

 



Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers

 

Community Server (Commercial Edition)