NHibernate的乙個示例

2022-07-17 19:54:14 字數 2225 閱讀 6384

一:建立poco實體

工廠表factoryentity,關聯企業表companyentiry,company_id關聯t_pm_company表

///

///企業表

/// [manytoone(name = "

companyentity

", classtype = typeof

(companyentity),

lazy = laziness.proxy, notfound = notfoundmode.ignore, column = "company_id",

unique = true, insert = false, update = false

)]

public

virtual

companyentity companyentity

二:定義dao增刪改查的介面,實現dao增刪改查的介面

配置dal.xml

ompanydao

" type="

pcitc.immc.pm.dal.companydao,pcitc.immc.pm.dal

">

"sessionfactory

"ref="

sessionfactory

" />

object>

三:定義bll裡的entity

四:定義bll增刪改查的介面,實現bll增刪改查的介面  

public

static entity.pmentity.factoryentity topoco(this

exentity.pmentity.factoryentity entity)

六:定義service增刪改查的介面,實現service增刪改查的介面

七:配置bll.xml

" type="

pcitc.immc.basicdata.factorybasicdata,pcitc.immc.basicdata

">

"factorybll

"ref="f

actorybll

"/>

object>

actorybll

" type="

pcitc.immc.pm.bll.classes.factorybll,pcitc.immc.pm.bll.classes

">

"factorydao

"ref="f

actorydao

"/>

object>

八:配置controller.xml

factorycontroller

" type="

pcitc.immc.ui.areas.pm.controllers.factorycontroller, pcitc.immc.ui

" singleton="

false

">

"factorybasicdata

"ref="

factorybasicdata

" />

object>

注意:配置檔案的object節點的id屬性,property 的name,ref屬性,首字母要小寫。否則依賴注入會失敗。

九:view裡呼叫action,controller實現查詢返回json資料給view

"

datagrid1

"class="

mini-datagrid

" style="

width:800px;height:280px;

" allowresize="

true

"url="

@url.action(

"getpagelistfactory"

)" idfield="

id" multiselect="

true

">

public jsonresult getpagelistfactory(int pageindex, int pagesize, string sortfield, string sortorder, string name, string stdcode, string

inuse)

xml的乙個示例

function.h cstring openfile cstring cstring getcontext cstring,int,int void str2array cstring struct xmlnode function.cpp include include include incl...

Flask Vue的乙個示例

這裡記錄下乙個flask vue的乙個示例 1.系統環境 python3.7 sqlite3資料庫,資料庫名稱 books.db 2.專案結構 title 測試 api books defbooks conn sqlite3.connect books.db conn.row factory sql...

乙個PlaySound示例

using system using system.collections using system.componentmodel using system.runtime.interopservices internal class helpers dllimport winmm public s...