Company framework Bo Template

Source: Internet
Author: User

<% @ Codetemplate Language = "C #" targetlanguage = "T-SQL" DEBUG = "true" compilerversion = "v3.5" Description = "" %>
<% @ Assembly name = "schemaexplorer" %>
<% @ Property name = "sourcetable" type = "schemaexplorer. tableschema" Optional = "false" Category = "required" %>
<% @ Property name = "namespace" Optional = "false" type = "system. string "default =" beyondbit. app. entity "Category =" style "Description =" object namespace. "%>
//----------------------------------------------------------------
// Copyright (c) 2012 Shanghai Internet software Co., Ltd.
// All Rights Reserved.
// All Rights Reserved.
//
// File name: Bo <% = sourcetable. name %>. CS
// File function description:
//
//
// Create an ID: <% = datetime. Now. tostring ("yyyy-mm-dd hh: mm: SS") %>
//
// Modify the ID:
// Modify the description:
//----------------------------------------------------------------
Using system;
Using system. Collections. Generic;
Using system. text;
Using beyondbit. Framework. Biz;
Using beyondbit. Framework. biz. Bo;
Using beyondbit. Framework. Core. interceptorhandler;
Using beyondbit. Framework. dataaccess;
Using beyondbit. Framework. dataaccess. objectdao;
Using beyondbit. documentspare. Dao;
Using beyondbit. documentspare. entity;
Using system. Data;
Using beyondbit. Core. Common. tools;

<% --
Sourcetable. Columns [I]. extendedproperties []
= Cs_isrowguidcol
= Cs_isidentity
= Cs_iscomputed
= Cs_isdeterministic
= Cs_identityseed
= Cs_identityincrement
= Cs_default
= Cs_computeddefinition
= Cs_collation
= Cs_objectid
= Cs_systemtype
= Cs_usertype
= Ms_description
= Cs_description
-- %>

Namespace <% = namespace %> {

Public class Bo <% = sourcetable. name %>: basebo {
Private Dao <% = sourcetable. name %> Dao = NULL;

/// <Summary>
/// Initialization variable of the constructor
/// </Summary>
Public examplebo ()
{
Dao = New Dao <% = sourcetable. name %> ();
}

/// <Summary>
/// Add
/// </Summary>
/// <Param name = "entity"> </param>
[Frame (true, false)]
Public Virtual void insert (<% = sourcetable. name %> entity)
{
Try
{
Dao. insert (entity );
}
Catch (dalexception ex)
{
Throw new boexception ("An error occurred while calling the insert method of Bo <% = sourcetable. name %>! ", Ex );
}
}

/// <Summary>
/// Modify
/// </Summary>
/// <Param name = "entity"> </param>
[Frame (true, false)]
Public Virtual void Update (<% = sourcetable. name %> entity)
{
Try
{
Dao. Update (entity );
}
Catch (dalexception ex)
{
Throw new boexception ("An error occurred while calling the update method of Bo <% = sourcetable. name %>! ", Ex );
}
}

/// <Summary>
/// Delete
/// </Summary>
/// <Param name = "entity"> </param>
[Frame (True, true)]
Public Virtual bool Delete (<% = sourcetable. name %> entity)
{
Try
{
Return Dao. deleteitem (entity. ID );
}
Catch (dalexception ex)
{
Throw new boexception ("An error occurred while calling the delete method of Bo <% = sourcetable. name %>! ", Ex );
}
}

/// <Summary>
///
/// </Summary>
/// <Param name = "ID"> </param>
/// <Returns> </returns>
[Frame (true, false)]
Public Virtual <% = sourcetable. name %> get (int id)
{
Try
{
Return Dao. Get (ID );
}
Catch (dalexception ex)
{
Throw new boexception ("An error occurred while calling the get method of Bo <% = sourcetable. name %>! ", Ex );
}
}

/// <Summary>
///
/// </Summary>
/// <Param name = "psearch"> </param>
/// <Param name = "strcondition"> </param>
/// <Returns> </returns>
[Frame (true, false)]
Public Virtual splitpageresult <% = sourcetable. name %> queryexampleinfo (pagesearch psearch, string strcondition)
{
Try
{
Return Dao. query <% = sourcetable. name %> (psearch, strcondition );
}
Catch (dalexception ex)
{
Throw new boexception ("An error occurred while calling the query <% = sourcetable. name %> of Bo <% = sourcetable. name %>! ", Ex );
}
}
}
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.