框架二

 


namespace  Unie2e.Yuking.Service
{
    
using System;
    
using System.Collections.Generic;
    
using System.Text;
    
using System.Data;
    
using System.Data.SqlClient;
    
using Unie2e.Common;
    
using Unie2e.ORM;
    
using Unie2e.ORM.Mapping;
    
using Unie2e.Service;
    
using Unie2e.Yuking.Enities;
    
using Unie2e.Yuking.Data;
    
    
    [Unie2e.Common.Model.E2EBOAttribute(
"DO")]
    
public partial class DOService<T> : POSService<T,DOEntity> where T:E2EData<DOEntity> ,new ()
    
    
{
        
        
protected override T DataConvert(DOEntity input)
        
{
            T t 
= new T();
            t.Meta 
= input;
            
return t;
        }

        
        
自动生成的Actionr操作
        
        
自动生成的查询方法
    }

    
    [Unie2e.Common.Model.E2EBOAttribute(
"DO")]
    
public partial class DOService : DOService<DO>
    
{
        DOItemService itemService;
        DOItemService getItemService()
        
{
            
if (itemService == null)
                itemService 
= new DOItemService();
            
return itemService;
        }

        
protected override void OnAfterAdded(DO d)
        
{
            ORMCollection
<DOItem> collection = d.DOItemCollection;
            
if (collection != null)
            
{
                d.DOItemCollection 
= getItemService().AddedBatch(collection);
            }


            
base.OnAfterAdded(d);
        }


        
protected override void OnBeforeUpdated(DO d)
        
{
            ORMCollection
<DOItem> collection = d.DOItemCollection;
            
if (collection != null)
            
{
                d.DOItemCollection 
= getItemService().SavedBatch(collection.GetOpChanges(DataState.Deleted));
                getItemService().DeletedBatch(collection.GetChanges(DataState.Deleted));
            }


            
base.OnBeforeUpdated(d);
        }

        
protected override void OnBeforeDeleted(DO d)
        
{
            ORMCollection
<DOItem> collection = d.DOItemCollection;
            
if (collection != null)
            
{
                d.DOItemCollection 
= getItemService().DeletedBatch(collection);
            }


            
base.OnBeforeDeleted(d);
        }

    }

}

 


namespace  Unie2e.Yuking.SDO
{
    
using System;
    
using System.Collections.Generic;
    
using System.Text;
    
using System.Data;
    
using System.Data.SqlClient;
    
using Unie2e.Common;
    
using Unie2e.Common.Model;
    
using Unie2e.Yuking.Common;

    
    [System.SerializableAttribute()]
    
public partial class DOSDO<T> : E2ESDO<T> where T : DOSDO<T>new()
    
    
{
        
        
映射字段
        
        
自动生成公开属性
        
        
public new static T CreateNew()
        
{
            T t 
= E2ESDO<T>.CreateNew();
            t.BeginInit();
            t.DOId 
= System.Guid.NewGuid();
            t.EndInit();
            
return t;
        }

    }

    
    [System.SerializableAttribute()]
    [Unie2e.Common.Model.E2ESDOAttribute(
"DO""DOServiceSO")]
    
public partial class DOSDO : DOSDO<DOSDO>
    
{
        
public DataCollection<DOItemSDO> DOItemCollection
        
{
            
get return GetCollection<DOItemSDO>(); }
            
set { SetCollection<DOItemSDO>(value); }
        }

    }

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值