• 大小: 3.3MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-10-26
  • 语言: 其他
  • 标签: Spring.Net  NHibernate  

资源简介

本例子是Spring.Net整合NHibernate的完整示例,下载后根据NHibernate配置文件建表直接运行即可。如果对你有帮助请评论给个好评。

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Spring.Context;
using Spring.Context.Support;
using Manager.Interface;
using log4net;
using Model;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            IApplicationContext ctx = ContextRegistry.GetContext();
            IUserManager userManager = ctx.Getobject(“userManager“) as IUserManager;
            ICompanyManger companyManger = ctx.Getobject(“companyManager“) as ICompanyManger;
            IFamliyManager famliyManager = ctx.Getobject(“famliyManager“) as IFamliyManager;

            //Company com = new Company();
            //com.CompanyName = “第六养猪厂“;
            //companyManger.Save(com);

            //User user = new User()
            //{
            //    UserName = “猪九戒“
            //    UserAge = 28
            //    UserSex = “女“
            //    CurrentCompany = companyManger.Get(1)
            //};
            //userManager.Save(user);

            Student student = new Student() { Name = “zjj“ };
            Famliy famliy = new Famliy() { Address = “hen nan province“ Student = student };
            famliyManager.Save(famliy);

            Console.WriteLine(“执行完成“);
            Console.ReadKey();
        }
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-05-03 15:44  SpringNetLesson18\
     目录           0  2018-05-03 13:46  SpringNetLesson18\.vs\
     目录           0  2018-05-23 10:22  SpringNetLesson18\.vs\SpringNetLesson18\
     目录           0  2018-05-23 10:22  SpringNetLesson18\.vs\SpringNetLesson18\DesignTimeBuild\
     文件         372  2018-05-23 10:22  SpringNetLesson18\.vs\SpringNetLesson18\DesignTimeBuild\.dtbcache
     目录           0  2018-05-03 13:46  SpringNetLesson18\.vs\SpringNetLesson18\v15\
     文件      113664  2018-05-23 10:22  SpringNetLesson18\.vs\SpringNetLesson18\v15\.suo
     目录           0  2018-05-03 13:46  SpringNetLesson18\.vs\SpringNetLesson18\v15\Server\
     目录           0  2018-05-23 09:03  SpringNetLesson18\.vs\SpringNetLesson18\v15\Server\sqlite3\
     文件           0  2018-05-03 13:46  SpringNetLesson18\.vs\SpringNetLesson18\v15\Server\sqlite3\db.lock
     文件      827392  2018-05-04 14:47  SpringNetLesson18\.vs\SpringNetLesson18\v15\Server\sqlite3\storage.ide
     文件       32768  2018-05-23 10:21  SpringNetLesson18\.vs\SpringNetLesson18\v15\Server\sqlite3\storage.ide-shm
     文件     1359632  2018-05-23 09:35  SpringNetLesson18\.vs\SpringNetLesson18\v15\Server\sqlite3\storage.ide-wal
     目录           0  2018-05-23 09:30  SpringNetLesson18\ConsoleApp\
     文件        1295  2018-05-03 17:03  SpringNetLesson18\ConsoleApp\App.config
     目录           0  2018-05-03 13:46  SpringNetLesson18\ConsoleApp\bin\
     目录           0  2018-05-23 09:35  SpringNetLesson18\ConsoleApp\bin\Debug\
     文件      116736  2009-06-21 10:10  SpringNetLesson18\ConsoleApp\bin\Debug\Antlr3.Runtime.dll
     文件       28672  2015-04-07 10:46  SpringNetLesson18\ConsoleApp\bin\Debug\Common.Logging.dll
     文件        5632  2018-05-23 09:37  SpringNetLesson18\ConsoleApp\bin\Debug\ConsoleApp.exe
     文件        1295  2018-05-03 17:03  SpringNetLesson18\ConsoleApp\bin\Debug\ConsoleApp.exe.config
     文件       11776  2018-05-23 09:37  SpringNetLesson18\ConsoleApp\bin\Debug\ConsoleApp.pdb
     文件        8704  2018-05-23 09:35  SpringNetLesson18\ConsoleApp\bin\Debug\DataAccess.dll
     文件       11776  2018-05-23 09:35  SpringNetLesson18\ConsoleApp\bin\Debug\DataAccess.pdb
     文件       32768  2009-11-22 12:35  SpringNetLesson18\ConsoleApp\bin\Debug\Iesi.Collections.dll
     文件       20992  2009-06-21 10:10  SpringNetLesson18\ConsoleApp\bin\Debug\LinFu.DynamicProxy.dll
     文件      270336  2009-06-21 10:10  SpringNetLesson18\ConsoleApp\bin\Debug\log4net.dll
     文件        7680  2018-05-23 09:37  SpringNetLesson18\ConsoleApp\bin\Debug\Manager.dll
     文件       17920  2018-05-23 09:37  SpringNetLesson18\ConsoleApp\bin\Debug\Manager.pdb
     文件        8704  2018-05-23 09:35  SpringNetLesson18\ConsoleApp\bin\Debug\Model.dll
     文件       19968  2018-05-23 09:35  SpringNetLesson18\ConsoleApp\bin\Debug\Model.pdb
............此处省略129个文件信息

评论

共有 条评论