温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:Asp.net3.5 MVC入门之文章管理源码
1#pragma warning disable 1591 2
//------------------------------------------------------------------------------ 3
// <auto-generated> 4
// 此代码由工具生成。 5
// 运行库版本:2.0.50727.1433 6
// 7
// 对此文件的更改可能会导致不正确的行为,并且如果 8
// 重新生成代码,这些更改将会丢失。 9
// </auto-generated> 10
//------------------------------------------------------------------------------ 11
12
namespace MvcArticleDemo.Models 13
{ 14
using System.Data.Linq; 15
using System.Data.Linq.Mapping; 16
using System.Data; 17
using System.Collections.Generic; 18
using System.Reflection; 19
using System.Linq; 20
using System.Linq.Expressions; 21
using System.ComponentModel; 22
using System; 23
24
25
[System.Data.Linq.Mapping.DatabaseAttribute(Name="ArticleDemo")] 26
public partial class ArticleDemoDataContext : System.Data.Linq.DataContext 27
{ 28
29
private static System.Data.Linq.Mapping.MappingSource mappingSource = new AttributeMappingSource(); 30
31
Extensibility Method Definitions 40
41
public ArticleDemoDataContext() : 42
base(global::System.Configuration.ConfigurationManager.ConnectionStrings["ArticleDemoConnectionString"].ConnectionString, mappingSource) 43
{ 44
OnCreated(); 45
} 46
47
public ArticleDemoDataContext(string connection) : 48
base(connection, mappingSource) 49
{ 50
OnCreated(); 51
} 52
53
public ArticleDemoDataContext(System.Data.IDbConnection connection) : 54
base(connection, mappingSource) 55
{ 56
OnCreated(); 57
} 58
59
public ArticleDemoDataContext(string connection, System.Data.Linq.Mapping.MappingSource mappingSource) : 60
base(connection, mappingSource) 61
{ 62
OnCreated(); 63
} 64
65
public ArticleDemoDataContext(System.Data.IDbConnection connection, System.Data.Linq.Mapping.MappingSource mappingSource) : 66
base(connection, mappingSource) 67
{ 68
OnCreated(); 69
} 70
71
public System.Data.Linq.Table<Categories> Categories 72
{ 73
get 74
{ 75
return this.GetTable<Categories>(); 76
} 77
} 78
79
public System.Data.Linq.Table<Article> Article 80
{ 81
get 82
{ 83
return this.GetTable<Article>(); 84
} 85
} 86
} 87
88
[Table(Name="dbo.Categories")] 89
public partial class Categories : INotifyPropertyChanging, INotifyPropertyChanged 90
{ 91
92
private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty); 93
94
private int _ID; 95
96
private string _CategoryName; 97
98
private EntitySet<Article> _Article; 99
100
Extensibility Method Definitions 109
110
public Categories() 111
{ 112
this._Article = new EntitySet<Article>(new Action<Article>(this.attach_Article), new Action<Article>(this.detach_Article)); 113
OnCreated(); 114
} 115
116
[Column(Storage="_ID", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)] 117
public int ID 118
{ 119
get 120
{ 121
return this._ID; 122
} 123
set 124
{ 125
if ((this._ID != value)) 126
{ 127
this.OnIDChanging(value); 128
this.SendPropertyChanging(); 129
this._ID = value; 130
this.SendPropertyChanged("ID"); 131
this.OnIDChanged(); 132
} 133
} 134
} 135
136
[Column(Storage="_CategoryName", DbType="NVarChar(50)")] 137
public string CategoryName 138
{ 139
get 140
{ 141
return this._CategoryName; 142
} 143
set 144
{ 145
if ((this._CategoryName != value)) 146
{ 147
this.OnCategoryNameChanging(value); 148
this.SendPropertyChanging(); 149
this._CategoryName = value; 150
this.SendPropertyChanged("CategoryName"); 151
this.OnCategoryNameChanged(); 152
} 153
} 154
} 155
156
[Association(Name="Categories_Article", Storage="_Article", OtherKey="CategoryID")] 157
public EntitySet<Article> Article 158
{ 159
get 160
{ 161
return this._Article; 162
} 163
set 164
{ 165
this._Article.Assign(value); 166
} 167
} 168
169
public event PropertyChangingEventHandler PropertyChanging; 170
171
public event PropertyChangedEventHandler PropertyChanged; 172
173
protected virtual void SendPropertyChanging() 174
{ 175
if ((this.PropertyChanging != null)) 176
{ 177
this.PropertyChanging(this, emptyChangingEventArgs); 178
} 179
} 180
181
protected virtual void SendPropertyChanged(String propertyName) 182
{ 183
if ((this.PropertyChanged != null)) 184
{ 185
this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); 186
} 187
} 188
189
private void attach_Article(Article entity) 190
{ 191
this.SendPropertyChanging(); 192
entity.Categories = this; 193
} 194
195
private void detach_Article(Article entity) 196
{ 197
this.SendPropertyChanging(); 198
entity.Categories = null; 199
} 200
} 201
202
[Table(Name="dbo.Article")] 203
public partial class Article : INotifyPropertyChanging, INotifyPropertyChanged 204
{ 205
206
private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty); 207
208
private int _ID; 209
210
private int _CategoryID; 211
212
private string _ArticleName; 213
214
private string _ArticleContent; 215
216
private System.Nullable<System.DateTime> _Date; 217
218
private EntityRef<Categories> _Categories; 219
220
Extensibility Method Definitions 235
236
public Article() 237
{ 238
this._Categories = default(EntityRef<Categories>); 239
OnCreated(); 240
} 241
242
[Column(Storage="_ID", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)] 243
public int ID 244
{ 245
get 246
{ 247
return this._ID; 248
} 249
set 250
{ 251
if ((this._ID != value)) 252
{ 253
this.OnIDChanging(value); 254
this.SendPropertyChanging(); 255
this._ID = value; 256
this.SendPropertyChanged("ID"); 257
this.OnIDChanged(); 258
} 259
} 260
} 261
262
[Column(Storage="_CategoryID", DbType="Int NOT NULL")] 263
public int CategoryID 264
{ 265
get 266
{ 267
return this._CategoryID; 268
} 269
set 270
{ 271
if ((this._CategoryID != value)) 272
{ 273
if (this._Categories.HasLoadedOrAssignedValue) 274
{ 275
throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); 276
} 277
this.OnCategoryIDChanging(value); 278
this.SendPropertyChanging(); 279
this._CategoryID = value; 280
this.SendPropertyChanged("CategoryID"); 281
this.OnCategoryIDChanged(); 282
} 283
} 284
} 285
286
[Column(Storage="_ArticleName", DbType="NVarChar(50)")] 287
public string ArticleName 288
{ 289
get 290
{ 291
return this._ArticleName; 292
} 293
set 294
{ 295
if ((this._ArticleName != value)) 296
{ 297
this.OnArticleNameChanging(value);




