• 自己制作的代码生成工具AutoCoder


    主窗口

    单个属性编辑窗口

    生成的代码文件

    生成的代码 :

    1. AbstractRecordFactory.cs(不允许开发人员修改)

      1 //生成时间:2012/1/13 10:44:59
    2 using System;
    3 using System.Collections.Generic;
    4 using PhoneIIModles.DataTools;
    5
    6 namespace PhoneIIModles.Record
    7 {
    8 public abstract class AbstractRecordFactory
    9 {
    10 protected abstract IDataTool<RecordInfo> GetDataTool();
    11
    12 public virtual List<RecordInfo> GetAll()
    13 {
    14 return GetDataTool().GetAll();
    15 }
    16
    17 public virtual List<RecordInfo> GetByFilters(List<FilterInfo> filters)
    18 {
    19 return GetDataTool().GetByFilter(filters);
    20 }
    21
    22 public virtual List<RecordInfo> GetByFilter(FilterInfo filter)
    23 {
    24 return GetDataTool().GetByFilter(new List<FilterInfo>() { filter });
    25 }
    26
    27 public virtual RecordInfo GetFirstOrDefault(List<FilterInfo> filters)
    28 {
    29 return GetDataTool().GetFirstOrDefault(filters);
    30 }
    31
    32 public virtual RecordInfo GetFirstOrDefault(FilterInfo filter)
    33 {
    34 return GetDataTool().GetFirstOrDefault(new List<FilterInfo>() { filter });
    35 }
    36
    37 public virtual void Add(RecordInfo info)
    38 {
    39 GetDataTool().Add(info);
    40 }
    41
    42 public virtual void Update(List<FilterInfo> filters, RecordInfo info)
    43 {
    44 GetDataTool().Update(filters, info);
    45 }
    46
    47 public virtual void Update(FilterInfo filter, RecordInfo info)
    48 {
    49 GetDataTool().Update(new List<FilterInfo>() { filter }, info);
    50 }
    51
    52 public virtual void Remove(List<FilterInfo> filters)
    53 {
    54 GetDataTool().Remove(filters);
    55 }
    56
    57 public virtual void Remove(FilterInfo filter)
    58 {
    59 GetDataTool().Remove(new List<FilterInfo>() { filter });
    60 }
    61
    62 public virtual List<RecordInfo> GetById( Guid id )
    63 {
    64 return GetDataTool().GetByFilter(new List<FilterInfo>() { new FilterInfo("Id", id) });
    65 }
    66
    67 public virtual RecordInfo GetFirstOrDefaultById( Guid id )
    68 {
    69 return GetDataTool().GetFirstOrDefault(new List<FilterInfo>() { new FilterInfo("Id", id) });
    70 }
    71
    72 public virtual int GetCountById( Guid id )
    73 {
    74 return GetDataTool().GetCount(new List<FilterInfo>() { new FilterInfo("Id", id) });
    75 }
    76
    77 public virtual void RemoveById( Guid id )
    78 {
    79 GetDataTool().Remove(new List<FilterInfo>() {new FilterInfo("Id", id) });
    80 }
    81
    82 public virtual void UpdataById( Guid id , RecordInfo info)
    83 {
    84 GetDataTool().Update(new List<FilterInfo>(){ new FilterInfo("Id", id) } , info);
    85 }
    86
    87 public virtual List<RecordInfo> GetByName( string name )
    88 {
    89 return GetDataTool().GetByFilter(new List<FilterInfo>() { new FilterInfo("Name", name) });
    90 }
    91
    92 public virtual RecordInfo GetFirstOrDefaultByName( string name )
    93 {
    94 return GetDataTool().GetFirstOrDefault(new List<FilterInfo>() { new FilterInfo("Name", name) });
    95 }
    96
    97 public virtual int GetCountByName( string name )
    98 {
    99 return GetDataTool().GetCount(new List<FilterInfo>() { new FilterInfo("Name", name) });
    100 }
    101
    102 public virtual void RemoveByName( string name )
    103 {
    104 GetDataTool().Remove(new List<FilterInfo>() {new FilterInfo("Name", name) });
    105 }
    106
    107 public virtual void UpdataByName( string name , RecordInfo info)
    108 {
    109 GetDataTool().Update(new List<FilterInfo>(){ new FilterInfo("Name", name) } , info);
    110 }
    111
    112 public virtual List<RecordInfo> GetByHomePhone( string homePhone )
    113 {
    114 return GetDataTool().GetByFilter(new List<FilterInfo>() { new FilterInfo("HomePhone", homePhone) });
    115 }
    116
    117 public virtual RecordInfo GetFirstOrDefaultByHomePhone( string homePhone )
    118 {
    119 return GetDataTool().GetFirstOrDefault(new List<FilterInfo>() { new FilterInfo("HomePhone", homePhone) });
    120 }
    121
    122 public virtual int GetCountByHomePhone( string homePhone )
    123 {
    124 return GetDataTool().GetCount(new List<FilterInfo>() { new FilterInfo("HomePhone", homePhone) });
    125 }
    126
    127 public virtual void RemoveByHomePhone( string homePhone )
    128 {
    129 GetDataTool().Remove(new List<FilterInfo>() {new FilterInfo("HomePhone", homePhone) });
    130 }
    131
    132 public virtual void UpdataByHomePhone( string homePhone , RecordInfo info)
    133 {
    134 GetDataTool().Update(new List<FilterInfo>(){ new FilterInfo("HomePhone", homePhone) } , info);
    135 }
    136
    137 public virtual List<RecordInfo> GetByCellPhone( string cellPhone )
    138 {
    139 return GetDataTool().GetByFilter(new List<FilterInfo>() { new FilterInfo("CellPhone", cellPhone) });
    140 }
    141
    142 public virtual RecordInfo GetFirstOrDefaultByCellPhone( string cellPhone )
    143 {
    144 return GetDataTool().GetFirstOrDefault(new List<FilterInfo>() { new FilterInfo("CellPhone", cellPhone) });
    145 }
    146
    147 public virtual int GetCountByCellPhone( string cellPhone )
    148 {
    149 return GetDataTool().GetCount(new List<FilterInfo>() { new FilterInfo("CellPhone", cellPhone) });
    150 }
    151
    152 public virtual void RemoveByCellPhone( string cellPhone )
    153 {
    154 GetDataTool().Remove(new List<FilterInfo>() {new FilterInfo("CellPhone", cellPhone) });
    155 }
    156
    157 public virtual void UpdataByCellPhone( string cellPhone , RecordInfo info)
    158 {
    159 GetDataTool().Update(new List<FilterInfo>(){ new FilterInfo("CellPhone", cellPhone) } , info);
    160 }
    161
    162 public virtual List<RecordInfo> GetByQQ( string QQ )
    163 {
    164 return GetDataTool().GetByFilter(new List<FilterInfo>() { new FilterInfo("QQ", QQ) });
    165 }
    166
    167 public virtual RecordInfo GetFirstOrDefaultByQQ( string QQ )
    168 {
    169 return GetDataTool().GetFirstOrDefault(new List<FilterInfo>() { new FilterInfo("QQ", QQ) });
    170 }
    171
    172 public virtual int GetCountByQQ( string QQ )
    173 {
    174 return GetDataTool().GetCount(new List<FilterInfo>() { new FilterInfo("QQ", QQ) });
    175 }
    176
    177 public virtual void RemoveByQQ( string QQ )
    178 {
    179 GetDataTool().Remove(new List<FilterInfo>() {new FilterInfo("QQ", QQ) });
    180 }
    181
    182 public virtual void UpdataByQQ( string QQ , RecordInfo info)
    183 {
    184 GetDataTool().Update(new List<FilterInfo>(){ new FilterInfo("QQ", QQ) } , info);
    185 }
    186
    187 public virtual List<RecordInfo> GetByEMail( string eMail )
    188 {
    189 return GetDataTool().GetByFilter(new List<FilterInfo>() { new FilterInfo("EMail", eMail) });
    190 }
    191
    192 public virtual RecordInfo GetFirstOrDefaultByEMail( string eMail )
    193 {
    194 return GetDataTool().GetFirstOrDefault(new List<FilterInfo>() { new FilterInfo("EMail", eMail) });
    195 }
    196
    197 public virtual int GetCountByEMail( string eMail )
    198 {
    199 return GetDataTool().GetCount(new List<FilterInfo>() { new FilterInfo("EMail", eMail) });
    200 }
    201
    202 public virtual void RemoveByEMail( string eMail )
    203 {
    204 GetDataTool().Remove(new List<FilterInfo>() {new FilterInfo("EMail", eMail) });
    205 }
    206
    207 public virtual void UpdataByEMail( string eMail , RecordInfo info)
    208 {
    209 GetDataTool().Update(new List<FilterInfo>(){ new FilterInfo("EMail", eMail) } , info);
    210 }
    211
    212 public virtual List<RecordInfo> GetByOther( string other )
    213 {
    214 return GetDataTool().GetByFilter(new List<FilterInfo>() { new FilterInfo("Other", other) });
    215 }
    216
    217 public virtual RecordInfo GetFirstOrDefaultByOther( string other )
    218 {
    219 return GetDataTool().GetFirstOrDefault(new List<FilterInfo>() { new FilterInfo("Other", other) });
    220 }
    221
    222 public virtual int GetCountByOther( string other )
    223 {
    224 return GetDataTool().GetCount(new List<FilterInfo>() { new FilterInfo("Other", other) });
    225 }
    226
    227 public virtual void RemoveByOther( string other )
    228 {
    229 GetDataTool().Remove(new List<FilterInfo>() {new FilterInfo("Other", other) });
    230 }
    231
    232 public virtual void UpdataByOther( string other , RecordInfo info)
    233 {
    234 GetDataTool().Update(new List<FilterInfo>(){ new FilterInfo("Other", other) } , info);
    235 }
    236
    237 public virtual List<RecordInfo> GetByAddress( string address )
    238 {
    239 return GetDataTool().GetByFilter(new List<FilterInfo>() { new FilterInfo("Address", address) });
    240 }
    241
    242 public virtual RecordInfo GetFirstOrDefaultByAddress( string address )
    243 {
    244 return GetDataTool().GetFirstOrDefault(new List<FilterInfo>() { new FilterInfo("Address", address) });
    245 }
    246
    247 public virtual int GetCountByAddress( string address )
    248 {
    249 return GetDataTool().GetCount(new List<FilterInfo>() { new FilterInfo("Address", address) });
    250 }
    251
    252 public virtual void RemoveByAddress( string address )
    253 {
    254 GetDataTool().Remove(new List<FilterInfo>() {new FilterInfo("Address", address) });
    255 }
    256
    257 public virtual void UpdataByAddress( string address , RecordInfo info)
    258 {
    259 GetDataTool().Update(new List<FilterInfo>(){ new FilterInfo("Address", address) } , info);
    260 }
    261
    262 public virtual List<RecordInfo> GetByGroupId( Guid groupId )
    263 {
    264 return GetDataTool().GetByFilter(new List<FilterInfo>() { new FilterInfo("GroupId", groupId) });
    265 }
    266
    267 public virtual RecordInfo GetFirstOrDefaultByGroupId( Guid groupId )
    268 {
    269 return GetDataTool().GetFirstOrDefault(new List<FilterInfo>() { new FilterInfo("GroupId", groupId) });
    270 }
    271
    272 public virtual int GetCountByGroupId( Guid groupId )
    273 {
    274 return GetDataTool().GetCount(new List<FilterInfo>() { new FilterInfo("GroupId", groupId) });
    275 }
    276
    277 public virtual void RemoveByGroupId( Guid groupId )
    278 {
    279 GetDataTool().Remove(new List<FilterInfo>() {new FilterInfo("GroupId", groupId) });
    280 }
    281
    282 public virtual void UpdataByGroupId( Guid groupId , RecordInfo info)
    283 {
    284 GetDataTool().Update(new List<FilterInfo>(){ new FilterInfo("GroupId", groupId) } , info);
    285 }
    286
    287 }
    288 }

    2. AbstractRecordInfo.cs (不允许开发人员修改)

     1 //自动生成请勿修改  生成时间:2012/1/13 10:44:59
    2 using System;
    3
    4 namespace PhoneIIModles.Record
    5 {
    6 public abstract class AbstractRecordInfo
    7 {
    8 public AbstractRecordInfo()
    9 {
    10 }
    11
    12 public AbstractRecordInfo ( Guid id, string name, string homePhone, string cellPhone, string QQ, string eMail, string other, string address, Guid groupId )
    13 {
    14 _id = id;
    15 _name = name;
    16 _homePhone = homePhone;
    17 _cellPhone = cellPhone;
    18 _QQ = QQ;
    19 _eMail = eMail;
    20 _other = other;
    21 _address = address;
    22 _groupId = groupId;
    23 }
    24
    25 Guid _id;
    26
    27 public Guid Id
    28 {
    29 get { return _id; }
    30 set { _id= value; }
    31 }
    32
    33 string _name;
    34
    35 public string Name
    36 {
    37 get { return _name; }
    38 set { _name= value; }
    39 }
    40
    41 string _homePhone;
    42
    43 public string HomePhone
    44 {
    45 get { return _homePhone; }
    46 set { _homePhone= value; }
    47 }
    48
    49 string _cellPhone;
    50
    51 public string CellPhone
    52 {
    53 get { return _cellPhone; }
    54 set { _cellPhone= value; }
    55 }
    56
    57 string _QQ;
    58
    59 public string QQ
    60 {
    61 get { return _QQ; }
    62 set { _QQ= value; }
    63 }
    64
    65 string _eMail;
    66
    67 public string EMail
    68 {
    69 get { return _eMail; }
    70 set { _eMail= value; }
    71 }
    72
    73 string _other;
    74
    75 public string Other
    76 {
    77 get { return _other; }
    78 set { _other= value; }
    79 }
    80
    81 string _address;
    82
    83 public string Address
    84 {
    85 get { return _address; }
    86 set { _address= value; }
    87 }
    88
    89 Guid _groupId;
    90
    91 public Guid GroupId
    92 {
    93 get { return _groupId; }
    94 set { _groupId= value; }
    95 }
    96
    97 }
    98 }

    3. RecordDataTool.cs (允许开发人员修改)

     1 //生成时间:2012/1/13 10:44:59
    2 using System;
    3 using PhoneIIModles.DataTools;
    4
    5 namespace PhoneIIModles.Record
    6 {
    7 /// <summary>
    8 /// 必须实现 IDataTool,可以选择继承 XMLBaseTool 或 DBBaseTool 这两个类已经实现接口
    9 /// 如果继承 XMLBaseTool 或 DBBaseTool 请添加构造函数 如 public UserDataTool(): base(a,b,c,d)
    10 /// </summary>
    11 public class RecordDataTool : IDataTool<RecordInfo>
    12 {
    13
    14
    15 }
    16 }

    4.RecordFactory.cs (允许开发人员修改)

     1 //生成时间:2012/1/13 10:44:59
    2 using System;
    3 using System.Collections.Generic;
    4 using PhoneIIModles.DataTools;
    5
    6 namespace PhoneIIModles.Record
    7 {
    8 public class RecordFactory : AbstractRecordFactory
    9 {
    10 protected override IDataTool<RecordInfo> GetDataTool()
    11 {
    12 // 可根据情况进行更改
    13 return new RecordDataTool();
    14 }
    15
    16 }
    17 }

    5. RecordInfo.cs (允许开发人员修改)

     1 //生成时间 :2012/1/13 10:44:59
    2 using System;
    3
    4 namespace PhoneIIModles.Record
    5 {
    6 public class RecordInfo: AbstractRecordInfo
    7 {
    8 public RecordInfo()
    9 {
    10 }
    11
    12 public RecordInfo ( Guid id, string name, string homePhone, string cellPhone, string QQ, string eMail, string other, string address, Guid groupId ) : base ( id, name, homePhone, cellPhone, QQ, eMail, other, address, groupId )
    13 {
    14 }
    15 }
    16 }

    未完待续。。。。
     

  • 相关阅读:
    ENVI数据格式
    旋转卡壳模板
    旋转卡壳求两个凸包最近距离poj3608
    树状数组模板
    输入输出挂
    Catalan数以及使用Raney引理证明
    【转】AC神组合数取模大全
    单向HASH——MurmurHash
    hdu4063(圆与圆交+线段与圆交+最短路)
    字符串HASH模板
  • 原文地址:https://www.cnblogs.com/GhostZCH/p/2321336.html
Copyright © 2020-2023  润新知