Mercurial > pub > bltoolkit
comparison Demo/Partial.Trust/Asp.Net/Default.aspx.cs @ 0:f990fcb411a9
Копия текущей версии из github
author | cin |
---|---|
date | Thu, 27 Mar 2014 21:46:09 +0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f990fcb411a9 |
---|---|
1 using System; | |
2 using System.Linq; | |
3 using System.Web.UI; | |
4 | |
5 using BLToolkit.Data; | |
6 using BLToolkit.Data.Linq; | |
7 | |
8 namespace Partial.Trust.Asp.Net | |
9 { | |
10 using Components; | |
11 | |
12 public partial class _Default : Page | |
13 { | |
14 protected void Page_Load(object sender, EventArgs e) | |
15 { | |
16 var da = PersonDataAccessor.CreateInstance(); | |
17 var list = da.GetPersonList(); | |
18 | |
19 Label1.Text = list[0].ContactName; | |
20 | |
21 var q = | |
22 from c in new Table<Customers>() | |
23 where c.CustomerID == list[0].CustomerID | |
24 select c.ContactName; | |
25 | |
26 Label2.Text = q.First(); | |
27 | |
28 using (var db = new DbManager()) | |
29 Label3.Text = _compiledQuery(db, list[0].CustomerID).ToList().First(); | |
30 } | |
31 | |
32 static readonly Func<DbManager,string,IQueryable<string>> _compiledQuery = | |
33 CompiledQuery.Compile((DbManager db, string id) => | |
34 from c in db.GetTable<Customers>() | |
35 where c.CustomerID == id | |
36 select c.ContactName); | |
37 } | |
38 } |