0
|
1 using System;
|
|
2 using System.Linq;
|
|
3
|
|
4 using BLToolkit.Data.Linq;
|
|
5 using BLToolkit.DataAccess;
|
|
6 using BLToolkit.Mapping;
|
|
7
|
|
8 using NUnit.Framework;
|
|
9
|
|
10 namespace Data.Exceptions
|
|
11 {
|
|
12 using Linq;
|
|
13
|
|
14 [TestFixture]
|
|
15 public class Mapping : TestBase
|
|
16 {
|
|
17 [Test, ExpectedException(typeof(LinqException))]
|
|
18 public void MapIgnore1()
|
|
19 {
|
|
20 ForEachProvider(typeof(LinqException), db =>
|
|
21 {
|
|
22 var q = from p in db.Person where p.Name == "123" select p;
|
|
23 q.ToList();
|
|
24 });
|
|
25 }
|
|
26
|
|
27 [TableName("Person")]
|
|
28 public class TestPerson1
|
|
29 {
|
|
30 public int PersonID;
|
|
31 [MapIgnore] public string FirstName;
|
|
32 }
|
|
33
|
|
34 [Test, ExpectedException(typeof(LinqException))]
|
|
35 public void MapIgnore2()
|
|
36 {
|
|
37 ForEachProvider(typeof(LinqException), db =>
|
|
38 db.GetTable<TestPerson1>().FirstOrDefault(_ => _.FirstName == null));
|
|
39 }
|
|
40 }
|
|
41 }
|