介绍一些c#方面的 spring资料。
即nspring。

解决方案 »

  1.   

    using System;
    using System.Collections;
    using OKEC.Sample.NHibernate.NHibernateTest;
    namespace OKEC.Sample.Spring
    {
        /// <summary>
        /// StartMain 的摘要说明。
        /// </summary>
        public class StartMain
         {
            public StartMain()
             {   //
                // TODO: 在此处添加构造函数逻辑
                //
             }
             [STAThread]
            static void Main() 
             {        
                //Startup Spring & NHibernate Content
                 SpringContext.init();            //Test Spring IOC
                 HelloTest test = (HelloTest)SpringContext.Context.GetObject("Hello");
                 test.Test();            //Test Spring & NHibernate
                 UserDao dao = SpringContext.Context.GetObject("UserDao") as UserDao;
                 User newUser = null;
                try
                 {
                     newUser = dao.Load("joe_cool");
                 }
                catch
                 {}
                if(newUser==null)
                 {
                     newUser = new User();
                     newUser.Id = "joe_cool";
                     newUser.UserName = "Joseph Cool";
                     newUser.Password = "abc123";
                     newUser.EmailAddress = "[email protected]";
                     newUser.LastLogon = DateTime.Now;
                    // Tell NHibernate that this object should be saved
                     dao.SaveObject(newUser);
                 }
                 User joeCool = dao.Load("joe_cool");
                // set Joe Cool's Last Login property
                 joeCool.LastLogon = DateTime.Now;
                // flush the changes from the Session to the Database
                 dao.UpdateObject(joeCool);
                 IList recentUsers = dao.GetAllObjectsList();
                foreach(User user in recentUsers)
                 {
                    //Assert.IsTrue(user.LastLogon > (new DateTime(2004, 03, 14, 20, 0, 0)) ); 
                     Console.WriteLine(user.UserName);
                     Console.WriteLine(user.Password);
                 }
                 Console.ReadLine();//让程序停留,回车关闭。
             }
         }
    }
      

  2.   

    参考一下吧。 http://topic.csdn.net/t/20061210/17/5220281.html 这东西用的人真不多,呵呵。
      

  3.   

    http://download.csdn.net/sort/tag/Spring
    http://www.cnblogs.com/iloveu/archive/2009/02/11/1388649.html
    http://www.cnblogs.com/buggavin/archive/2005/09/28/245922.html