Mercurial > pub > bltoolkit
diff Demo/Partial.Trust/Asp.Net/Default.aspx.cs @ 0:f990fcb411a9
Копия текущей версии из github
author | cin |
---|---|
date | Thu, 27 Mar 2014 21:46:09 +0400 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Demo/Partial.Trust/Asp.Net/Default.aspx.cs Thu Mar 27 21:46:09 2014 +0400 @@ -0,0 +1,38 @@ +using System; +using System.Linq; +using System.Web.UI; + +using BLToolkit.Data; +using BLToolkit.Data.Linq; + +namespace Partial.Trust.Asp.Net +{ + using Components; + + public partial class _Default : Page + { + protected void Page_Load(object sender, EventArgs e) + { + var da = PersonDataAccessor.CreateInstance(); + var list = da.GetPersonList(); + + Label1.Text = list[0].ContactName; + + var q = + from c in new Table<Customers>() + where c.CustomerID == list[0].CustomerID + select c.ContactName; + + Label2.Text = q.First(); + + using (var db = new DbManager()) + Label3.Text = _compiledQuery(db, list[0].CustomerID).ToList().First(); + } + + static readonly Func<DbManager,string,IQueryable<string>> _compiledQuery = + CompiledQuery.Compile((DbManager db, string id) => + from c in db.GetTable<Customers>() + where c.CustomerID == id + select c.ContactName); + } +}