拜读websharp时,发现的几处问题(三)
6.在DEMO项目Ioffice中也有一些小问题,对于Ioffice.Interfaces项目中,实现对Schdule实体的操作接口ISchduleSystem 用此接口来实现对Schdule实现的操作,咋一看非常不错,但仔细想想还是有些小问题。问题在于,如果按照上面的实现 方式,我们需要对所有的实体都写一个相当于上面的接口来实现对每个实体的操作,如果能再次对实体进行抽象,改成一个通用的实体操作接口,是不是更好一些呢?
代码如下:
1
using System;
2
using Ioffice.Interfaces.EntityDefinition;
3
using Websharp.ORM.Base;
4![](/Images/OutliningIndicators/None.gif)
5
namespace Ioffice.Interfaces
6![](/Images/OutliningIndicators/ContractedBlock.gif)
![](https://www.cnblogs.com/Images/dot.gif)
![](/Images/OutliningIndicators/None.gif)
2
![](/Images/OutliningIndicators/None.gif)
3
![](/Images/OutliningIndicators/None.gif)
4
![](/Images/OutliningIndicators/None.gif)
5
![](/Images/OutliningIndicators/None.gif)
6
![](/Images/OutliningIndicators/ContractedBlock.gif)
![](https://www.cnblogs.com/Images/dot.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/None.gif)
![](/Images/OutliningIndicators/ContractedBlock.gif)
![](https://www.cnblogs.com/Images/dot.gif)
![](/Images/OutliningIndicators/None.gif)
1
using System;
2
using Websharp.Data;
3
using Websharp.ORM.Base;
4![](/Images/OutliningIndicators/None.gif)
5
namespace Ioffice.Interfaces
6
{
7
/// <summary>
8
/// OjbectDALSystemFactory
9
/// </summary>
10
public class ObjectDALSystemFactory
11
{
12
private ObjectDALSystemFactory(){}
13![](/Images/OutliningIndicators/InBlock.gif)
14
private static ObjectDALSystemFactory m_ObjectDALSystemFactory = new ObjectDALSystemFactory();
15![](/Images/OutliningIndicators/InBlock.gif)
16
public static ObjectDALSystemFactory Instance()
17
{
18
return m_ObjectDALSystemFactory;
19
}
20
public IObjectSystem CreateIObjectSystem()
21
{
22
return p_CreateIObjectSystem();
23
}
24![](/Images/OutliningIndicators/InBlock.gif)
25
private IObjectSystem p_CreateIObjectSystem()
26
{
27
return new ObjectDALSystem();
28
}
29
}
30
}
31![](/Images/OutliningIndicators/None.gif)
使用方法如下:![](/Images/OutliningIndicators/None.gif)
2
![](/Images/OutliningIndicators/None.gif)
3
![](/Images/OutliningIndicators/None.gif)
4
![](/Images/OutliningIndicators/None.gif)
5
![](/Images/OutliningIndicators/None.gif)
6
![](/Images/OutliningIndicators/ExpandedBlockStart.gif)
7
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
8
![](/Images/OutliningIndicators/InBlock.gif)
9
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
10
![](/Images/OutliningIndicators/InBlock.gif)
11
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
12
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
13
![](/Images/OutliningIndicators/InBlock.gif)
14
![](/Images/OutliningIndicators/InBlock.gif)
15
![](/Images/OutliningIndicators/InBlock.gif)
16
![](/Images/OutliningIndicators/InBlock.gif)
17
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
18
![](/Images/OutliningIndicators/InBlock.gif)
19
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
20
![](/Images/OutliningIndicators/InBlock.gif)
21
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
22
![](/Images/OutliningIndicators/InBlock.gif)
23
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
24
![](/Images/OutliningIndicators/InBlock.gif)
25
![](/Images/OutliningIndicators/InBlock.gif)
26
![](/Images/OutliningIndicators/ExpandedSubBlockStart.gif)
27
![](/Images/OutliningIndicators/InBlock.gif)
28
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
29
![](/Images/OutliningIndicators/ExpandedSubBlockEnd.gif)
30
![](/Images/OutliningIndicators/ExpandedBlockEnd.gif)
31
![](/Images/OutliningIndicators/None.gif)
1
T1 t1 = EntityManager.CreateObject(typeof(T1)) as T1;
2
t1.A = "3333";
3
t1.B = null;
4
t1.C= 199;
5
t1.D = System.DateTime.Now;
6
t1.F = 2;
7![](/Images/OutliningIndicators/None.gif)
8
IObjectSystem IOS = ObjectDALSystemFactory.Instance().CreateIObjectSystem();
9![](/Images/OutliningIndicators/None.gif)
10
IOS.AddObject(t1);
![](/Images/OutliningIndicators/None.gif)
2
![](/Images/OutliningIndicators/None.gif)
3
![](/Images/OutliningIndicators/None.gif)
4
![](/Images/OutliningIndicators/None.gif)
5
![](/Images/OutliningIndicators/None.gif)
6
![](/Images/OutliningIndicators/None.gif)
7
![](/Images/OutliningIndicators/None.gif)
8
![](/Images/OutliningIndicators/None.gif)
9
![](/Images/OutliningIndicators/None.gif)
10
![](/Images/OutliningIndicators/None.gif)