Results 1 to 6 of 6

Thread: Need help to start a new project

  1. #1
    Join Date
    May 2005
    Posts
    2

    Default Need help to start a new project

    I am tasked with a new project and my boss wants to use .NET technology. I used Spring and Hibenate for last project in Java. I would like to use Spring.NET and NHibernate for this new project in .NET. I am only a beginner in .NET world. I just wonder if this is the right direction that I should take with the fact Spring.net and NHibernate is still not mature yet.

  2. #2
    Mark Pollack is offline Spring.NET Co-Lead Spring TeamSpring User
    Join Date
    Sep 2004
    Location
    New York, NY
    Posts
    1,683

    Default

    Hi,

    As far as Spring.NET goes the core container is mature imho and I don't have any reservations suggesting that you use it for your next project. The benefits of dependency injection alone justify using it for your new .NET project. The other libraries that we will release will also very likely be beneficial to you. Spring.NET is currently being used in a number of production apps - though we haven't set the current release status to production on sourceforge. We continue to be conservative about applying that label but the next release will most likely be upgraded to production status.

    Just like NHibernate, there are loads of unit tests and we have very good code coverage. I can't say anything from extensive first hand experience with NHibernate - but the little I did worked well. As we develop out the data access library this summer I'll be poking deeper and will port over a complex in house Hibernate.Java application as a test case. It would probably be worthwhile for you to make a prototype and shop around for other user experiences. I'd also take a second to see how much your app will benefit from a domain model. Sending around ADO.NET datasets or using a sql mapper like iBatis.NET may be valid alternatives instead of using a full fledged orm tool. Colleagues of mine at work have been very satisfied with iBatis.NET.

    Cheers,
    Mark

  3. #3
    Join Date
    May 2005
    Posts
    2

    Default Integrate NHibernate + Spring.NET

    Thank you very much for your advice. Is there any example that have Spring.NET and NHibernate integrate together? If not, is it going to be included for your next Spring.NET release? Do you have an approx. date for the next Spring.NET release? Thanks

  4. #4
    Mark Pollack is offline Spring.NET Co-Lead Spring TeamSpring User
    Join Date
    Sep 2004
    Location
    New York, NY
    Posts
    1,683

    Default

    Hi,

    There are no examples of Spring.NET with NHibernate since we haven't written anything similar to the hibernate support available in Spring.Java. The next release will button up the IoC container - I'd like to give a firm date but I'm always terrible estimating - I'm already past my April deadline. It isn't much work really (~week) just a matter of getting to it. You can see if there are any issues that are important to you in that release (0.6.0) by browsing through jira. Beyond that, take a look at our roadmap on our wiki. The 0.7 family will contain many new features - AOP, web, and "services" (see the wiki docs). Afterwards would be the data access libraries. There is already some code in CVS for ado.net and there will be some shortly for iBatis.NET though it is in the early stages. I realize this is all a bit vague in terms of exact dates but I hope it helps anyway.

    Cheers,
    Mark

  5. #5
    Join Date
    Mar 2005
    Posts
    78

    Default

    Quote Originally Posted by Mark Pollack
    Hi,
    There is already some code in CVS for ado.net and there will be some shortly for iBatis.NET though it is in the early stages. I realize this is all a bit vague in terms of exact dates but I hope it helps anyway.
    But, it should be pointed out that it's really not the least bit difficult to use frameworks like NHibernate or iBATIS in Spring.net applications today. These are just services you need to locate like any other. The integration modules are cool, but they are by no means essential!

    The simplest thing is to start by writing your NHibernate business objects independantly of Spring. I expect NHibernate has a sample singleton you can use to load it with a conventional application. You can just wrap that call in the base business class object. Here's one for iBATIs, but you should get the idea:

    Code:
    		public SqlMapper Mapper 
    		{
    			get {return IBatisNet.DataMapper.Mapper.Instance ();}
    		}
    (For an example of using a singleton to load a framework configuration file , see [http://ibatisnet.sourceforge.net/Dev....html#d0e3133])

    Then, you can start using Spring to inject the *business objects* themselves into your program. This is especially great for web applications, because your pages don't need to know much about the business objects. You just need to put a property for the business object on your ASP.NET page, and then let Spring inject it.

    If you want to get fancy, you can also inject the NHibernate singleton. You can configure just about anything (or maybe anything) in the Spring config. But, you don't *have* to. You can use conventional singletons alongside Spring, and refactor later. (Which I should actually do myself, now that everything else is running!)

    I came over from Java myself. But, once I had the JetBrains Resharper and Ahnk Subversion plugins going, along with MySQL, iBATIS, and Spring, it feels like I never left.

    HTH, Ted.

  6. #6
    Join Date
    Mar 2005
    Posts
    78

    Default Who's your daddy?

    Quote Originally Posted by Ted Husted
    You can use conventional singletons alongside Spring, and refactor later. (Which I should actually do myself, now that everything else is running!)
    Process complete. :wink:

    I changed the Mapper property so that it stopped loading the singleton itself. I then wrapped our singleton in a Spring element:

    Code:
     <object id="Mapper" type="IBatisNet.DataMapper.Mapper, IBatisNet.DataMapper" factory-method="Instance"/>
    To inject the Mapper into the business commands that need it, I setup a base element:

    Code:
     <object id="BaseCommand" >
         <property name="Mapper"><ref object="Mapper"/></property>
     </object>
    And made this the parent of the (64) business commands.

    Code:
      <object id="program_delete" type="WNE.Core.Commands.BaseDelete, WNE.Core" parent="BaseCommand">
        <property name="ID"><value>program_delete</value></property></object>
    Run the tests; edit some flubbed XML; fix some naive code; run the tests; everybody is happy.

    Code:
      ------ Test started&#58; Assembly&#58; WNE.Test.dll ------
    
      98 succeeded, 0 failed, 0 skipped, took 38.51 seconds.
    
      ---------------------- Done ----------------------
    8) Way cool.

    While I was at it, I setup parent elements for other common object types. :idea: I'm thinking that a base element for a common object type is a best practice, just like having base objects and base pages.

    -Ted.

Similar Threads

  1. Application Start
    By djeeg in forum Web
    Replies: 2
    Last Post: 12-05-2007, 07:17 PM
  2. Replies: 8
    Last Post: 02-02-2006, 07:02 AM
  3. HTTP 404 in SpringAir when launching start page
    By scottnelsonsmith in forum Web
    Replies: 3
    Last Post: 12-17-2005, 12:28 PM
  4. Sample Spring.Web Project
    By hhoang in forum Web
    Replies: 3
    Last Post: 09-02-2005, 07:46 PM
  5. project status
    By boegman in forum Web
    Replies: 1
    Last Post: 05-23-2005, 03:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •