ORM Battle, реинкарнация
От: Danchik Украина  
Дата: 11.11.15 14:35
Оценка: 68 (1) +1
Игорь привет,

Уж и не знаю куда этот проект делся, но сурцы на гуглкоде еще есть. Решил попробовать добавить туда Linq2db.
Есть ошибки на на Linq тестах. Некоторые фиксаются, некоторые нет. Но вот один ассертнутый тест насторожил:

    [Test]
    [Category("Join")]
    public void GroupJoinTest()
    {
      var result = 
        from c in db.Customers
        join o in db.Orders on c.Id equals o.Customer.Id into go
        join e in db.Employees on c.City equals e.City into ge
        select new {
                     OrdersCount = go.Count(),
                     EmployeesCount = ge.Count()
                   };
      var list = result.ToList();
      Assert.AreEqual(91, list.Count);
    }


И сам запрос

-- Northwind SqlServer.2012
SELECT
    (
        SELECT
            Count(*)
        FROM
            [dbo].[Orders] [t2]
                LEFT JOIN [dbo].[Customers] [t1] ON [t2].[CustomerID] = [t1].[CustomerID]
        WHERE
            [c].[CustomerID] = [t1].[CustomerID]
    ) as [c1],
    (
        SELECT
            Count(*)
        FROM
            [dbo].[Employees] [t3]
        WHERE
            [c].[City] IS NULL AND [t3].[City] IS NULL OR [c].[City] = [t3].[City]
    ) as [c2]
FROM
    [dbo].[Customers] [c]
        LEFT JOIN [dbo].[Orders] [go1]
            LEFT JOIN [dbo].[Customers] [t4] ON [go1].[CustomerID] = [t4].[CustomerID]
        ON [c].[CustomerID] = [t4].[CustomerID]


Я то понимаю почему так случилось, но девелопер, может долго медитировать, откуда взялся LEFT JOIN и почему такой странный SELECT. Думаю этот случай надо обработать.

P.S. Сами результаты тестов (только BLToolkit и Linq2db)

LINQ tests scorecard:
                                       BLT      L2DB   Maximum      Unit
LINQ Implementation:            
  Aggregates                             1         0         5       f/a
  All/Any/Contains                       1         1         6       f/a
  Complex                                6         4         6       f/a
  Element operations                     5         0         9       f/a
  Filtering                              0         0        12       f/a
  Grouping                               3         1        10       f/a
  Join                                   0       1/1         4       f/a
  Ordering                               0         0         8       f/a
  Projections                          2/1         1        13       f/a
  References                             0         1         4       f/a
  Set operations                         0         1         9       f/a
  Standard functions                     0         0        25       f/a
  Take/Skip                              1         0         5       f/a
  Type casts                             0         0         5       f/a
Total:                          
  Performed                            121       121       121         #
  Passed                               102       111       121         #
  Failed                                19        10       121         #
    Properly                            18         9       121         #
    Asserted                             1         1       121         #
  Score                               84.3      91.7     100.0         %

Units:
  f/a: total count of failed tests [ / count of tests failed with assertion ],
       less is better (0 is ideal);
  #:   count;
  %:   percentage (% of passed tests), more is better.


Performance tests (30000 items) scorecard:
                                       BLT      L2DB      Unit
CRUD Performance:               
  Fetch                              12290      9532      op/s
  Single Operation:             
    Create Instance                   9228      8347      op/s
    Update Instance                  12351     13997      op/s
    Remove Instance                  13188     13565      op/s
    CUD Average                      11160     11111      op/s
  Multiple Operations:          
    Create Instance                  50752    204782      op/s
    Update Instance                  53162    800689      op/s
    Remove Instance                  83949   1010751      op/s
    CUD Average                      58946    418876      op/s
Data Access Performance:        
  Query:                        
    LINQ Query                        9186      9843 queries/s
    Compiled LINQ Query              13808     12596 queries/s
    Native Query                     16064     15122 queries/s
  Paging (LINQ only):           
    Get Small Page   (10 items)      12188     11132   pages/s
    Get Average Page (20 items)      10912     10884   pages/s
    Get Large Page   (50 items)       8517      9218   pages/s
    Get Huge Page    (100 items)      6184      6802   pages/s
  Materialization:              
    LINQ Materialize               1151591   1388181 objects/s
    Native Materialize             1568996   1831043 objects/s

Units:
  op/s:      operations per second, more is better;
  queries/s: queries per second, more is better;
  pages/s:   pages per second, more is better;
  objects/s: # of materialized objects per second, more is better.


Исходники по реквесту могу кинуть, не заморачивался с GitHub, не знаю как к этому отнесется изначальный автор проекта
 
Подождите ...
Wait...
Пока на собственное сообщение не было ответов, его можно удалить.