ProviderCollection.cst 项目数据提供者集合
1
<%--
2
Name:
3
Author:
4
Description:
5
--%>
6
<%@ CodeTemplate Language="C#" ResponseEncoding="UTF-8" TargetLanguage="Text" Src="" Inherits="" Debug="False" Description="Template description here." %>
7![]()
8
<%@ Assembly Name="System.Data" %>
9
<%@ Import Namespace="System.Data" %>
10![]()
11
<%@ Property Name="NameSpace" Type="System.String" Default="" Optional="false" Category="命名空间" Description="当前生成实体类的命名空间" %>
12
<%@ Property Name="ModuleName" Type="System.String" Default="" Optional="false" Category="" Description="项目名称" %>
13![]()
14
using System;
15
using System.Collections.Generic;
16
using System.Text;
17
using System.Configuration.Provider;
18![]()
19
namespace <%= NameSpace%>.Framework
20
{
21
/// <summary>
22
/// 项目数据提供者集合。
23
/// </summary>
24
public partial class <%= ModuleName%>ProviderCollection : ProviderCollection
25
{
26
/// <summary>
27
/// 获取项目数据提供者集合。
28
/// </summary>
29
/// <param name="name">服务提供者名称。</param>
30
/// <returns></returns>
31
public new <%= ModuleName%>Provider this[string name]
32
{
33
get { return (<%= ModuleName%>Provider)base[name]; }
34
}
35![]()
36
/// <summary>
37
/// 添加项目数据提供者。
38
/// </summary>
39
/// <param name="provider">项目数据提供者。</param>
40
public override void Add(ProviderBase provider)
41
{
42
if (provider == null)
43
throw new ArgumentNullException("provider");
44![]()
45
if (!(provider is <%= ModuleName%>Provider))
46
throw new ArgumentException("Invalid provider type", "provider");
47![]()
48
base.Add(provider);
49
}
50
}
51
}
52
<script runat="template">
53![]()
54
</script>

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54
