-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathGenericPage.cs
42 lines (40 loc) · 953 Bytes
/
GenericPage.cs
1
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
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using System.Web.UI;
namespace Moon.Mvc
{
/// <summary>
/// 泛型Model页面
/// </summary>
/// <typeparam name="TModel">model的类型</typeparam>
public class GenericPage<TModel> : MViewPage
{
public TModel Model
{
get;
set;
}
public override void SetModel(object model)
{
if (model != null)
{
this.Model = (TModel)model;
_ModelType = model.GetType();
Html = new MHtmlHelper<TModel>(this.Model, this.Context);
}
else
{
this.Model = default(TModel);
_ModelType = null;
}
}
public MHtmlHelper<TModel> Html
{
get;
set;
}
}
}