-
Notifications
You must be signed in to change notification settings - Fork 455
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
194b4e8
commit 46bfc10
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.ComponentModel; | ||
using System.ComponentModel.DataAnnotations; | ||
using System.Linq; | ||
using System.Runtime.Serialization; | ||
using LinqToDB; | ||
using LinqToDB.Data; | ||
using LinqToDB.Mapping; | ||
using Newtonsoft.Json; | ||
using NUnit.Framework; | ||
|
||
namespace Tests.UserTests.Test3847 | ||
{ | ||
public class OutfeedTransportOrderDTO | ||
{ | ||
public virtual Guid Id { get; set; } | ||
} | ||
|
||
[TestFixture] | ||
public class Issue3847Tests : TestBase | ||
{ | ||
[Test] | ||
public void Test3847([IncludeDataSources(TestProvName.AllSQLite, TestProvName.AllSqlServer, TestProvName.AllPostgreSQL)] string configuration) | ||
{ | ||
using (var db = GetDataContext( | ||
configuration, | ||
new FluentMappingBuilder() | ||
.Entity<OutfeedTransportOrderDTO>() | ||
.HasTableName("Test3847_OutfeedTransportOrder") | ||
.Build() | ||
.MappingSchema)) | ||
{ | ||
using (db.CreateLocalTable<OutfeedTransportOrderDTO>()) | ||
{ | ||
var _lastCheck = new Dictionary<Guid, DateTime>(); | ||
var _nextCheck = new Dictionary<Guid, DateTime>(); | ||
IQueryable<KeyValuePair<Guid, DateTime>> lastcheckquery = _lastCheck.AsQueryable(); | ||
IQueryable<KeyValuePair<Guid, DateTime>> nextcheckquery = _nextCheck.AsQueryable(); | ||
|
||
var qry = from outfeed in db.GetTable<OutfeedTransportOrderDTO>() | ||
select new | ||
{ | ||
OutfeedTransportOrder = outfeed, | ||
LastCheck = lastcheckquery.Where(x => x.Key == outfeed.Id).Select(x => (DateTime?)x.Value).FirstOrDefault(), | ||
NextCheck = nextcheckquery.Where(x => x.Key == outfeed.Id).Select(x => (DateTime?)x.Value).FirstOrDefault(), | ||
|
||
}; | ||
|
||
var d = qry.ToList(); | ||
var sql = ((DataConnection)db).LastQuery; | ||
} | ||
} | ||
} | ||
} | ||
} |