关于映射方面的问题?c#!请上海的高手为老师!付费!
以下是我最近学的一个案例,用的内容,我相请一个高用指点,最好是在上海,沟通方面。本人愿付学费!
using System;
using cenetcom.util;
namespace cenetcom
{
/// <summary>
/// 数据库连接 的摘要说明。
/// </summary>
///
[StoreUnit(StoreUnitType.Xml|StoreUnitType.Define)]
public class 数据库连接
{
public 数据库连接()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
[Field]
public string 定义名称;
[Field]
public string 服务器;
[Field]
public string 用户名;
[Field]
public string 密码;
[Field]
public bool 集成登录;
public static 数据库连接 本地连接定义
{
get
{
数据库连接 lj=(数据库连接)FastObject.PickObject(typeof(数据库连接).FullName,"定义名称","数据库");
if (lj!=null) return lj;
else
{
lj=new 数据库连接();
lj.定义名称="数据库";
return lj;
}
}
}
}
}
-------------------------------
namespace cenetcom
{
/// <summary>
/// 存储单元的定义,包含对象的存储映射方式
/// </summary>
///
[AttributeUsage(AttributeTargets.All)]
public class StoreUnit:System.Attribute
{
public StoreUnit()
{
}
private StoreUnitType type;
private string logicname="Default";
private string storename="Default";
public StoreUnit(StoreUnitType type)
{
this.type=type;
if (!In(StoreUnitType.Db)) this.type|=StoreUnitType.Xml;
if (!In(StoreUnitType.Define)) this.type|=StoreUnitType.Public;
}
public StoreUnit(StoreUnitType type,string maplogicname)
{
this.type=type;
if (!In(StoreUnitType.Db)) this.type|=StoreUnitType.Xml;
if (!In(StoreUnitType.Define)) this.type|=StoreUnitType.Public;
this.logicname=maplogicname;
}
public StoreUnitType Type
{
get
{
return type;
}
}
public bool In(StoreUnitType type)
{
int x=Convert.ToInt16((this.type&type));
return (x!=0);
}
public string StoreName
{
get
{
return storename;
}
}
public string LogicName
{
get
{
return logicname;
}
}
public static StoreUnit Default=new StoreUnit(StoreUnitType.Public|StoreUnitType.Xml);
}
}