@@ -44,9 +44,17 @@ You can also register additional options (like interceptors) for LinqToDB during
4444``` cs 
4545var  optionsBuilder  =  new  DbContextOptionsBuilder <MyDbContext >();
4646optionsBuilder .UseSqlite ();
47- optionsBuilder .UseLinqToDb (builder  =>   
47+ optionsBuilder .UseLinqToDB (builder  => 
4848{
49+     //  add custom command interceptor 
4950     builder .AddInterceptor (new  MyCommandInterceptor ());
51+     //  add additional mappings 
52+      builder .AddMappingSchema (myCustomMappings );
53+     //  configure SQL Server dialect explicitly 
54+     // builder.AddCustomOptions(o => o.UseSqlServer(SqlServerVersion.v2022)); 
55+     //  due to bug in linq2db 5.0.0, use overload with connection string 
56+     //  will be fixed in next linq2db release 
57+      builder .AddCustomOptions (o  =>  o .UseSqlServer (" unused"  , SqlServerVersion .v2022 ));
5058});
5159``` 
5260
@@ -58,10 +66,10 @@ ctx.BulkCopy(new BulkCopyOptions {...}, items);
5866
5967//  query for retrieving products that do not have duplicates by Name
6068var  query  = 
61- 	 from  p  in  ctx .Products 
62- 	 from  op  in  ctx .Products .LeftJoin (op  =>  op .ProductID  !=  p .ProductID  &&  op .Name  ==  p .Name )
63- 	 where  Sql .ToNullable (op .ProductID ) ==  null 
64- 	 select  p ;
69+      from  p  in  ctx .Products 
70+      from  op  in  ctx .Products .LeftJoin (op  =>  op .ProductID  !=  p .ProductID  &&  op .Name  ==  p .Name )
71+      where  Sql .ToNullable (op .ProductID ) ==  null 
72+      select  p ;
6573
6674//  insert these records into the same or another table
6775query .Insert (ctx .Products .ToLinqToDBTable (), s  =>  new  Product  { Name  =  s .Name  .. . });
@@ -90,13 +98,13 @@ It is not required to work directly with `LINQ To DB` `DataConnection` class but
9098
9199``` cs 
92100//  uing DbContext
93- using  (var  dc  =  ctx .CreateLinqToDbConnection ())
101+ using  (var  dc  =  ctx .CreateLinqToDBConnection ())
94102{
95103   //  linq queries using linq2db extensions 
96104 }
97105
98106//  using DbContextOptions
99- using  (var  dc  =  options .CreateLinqToDbConnection ())
107+ using  (var  dc  =  options .CreateLinqToDBConnection ())
100108{
101109   //  linq queries using linq2db extensions 
102110 }
@@ -110,35 +118,35 @@ Async methods have the same name but with `LinqToDB` suffix. E.g. `ToListAsyncLi
110118``` cs 
111119using  (var  ctx  =  CreateAdventureWorksContext ())
112120{
113- 	 var  productsWithModelCount  = 
114- 		 from  p  in  ctx .Products 
115- 		 select  new 
116- 		 {
117- 			 //  Window Function
118- 			 Count  =  Sql .Ext .Count ().Over ().PartitionBy (p .ProductModelID ).ToValue (),
119- 			 Product  =  p 
120- 		 };
121- 
122- 	 var  neededRecords  = 
123- 		 from  p  in  productsWithModelCount 
124- 		 where  p .Count .Between (2 , 4 ) //  LINQ To DB extension
125- 		 select  new 
126- 		 {
127- 			 p .Product .Name ,
128- 			 p .Product .Color ,
129- 			 p .Product .Size ,
130- 			 //  retrieving value from column dynamically
131- 			 PhotoFileName  =  Sql .Property <string >(p .Product , " ThumbnailPhotoFileName"  )
132- 		 };
133- 
134- 	 //  ensure we have replaced EF context
135- 	 var  items1  =  neededRecords .ToLinqToDB ().ToArray ();       
136- 	 
137- 	 //  async version
138- 	 var  items2  =  await  neededRecords .ToLinqToDB ().ToArrayAsync (); 
139- 	 
140- 	 //  and simple bonus - how to generate SQL
141- 	 var  sql  =  neededRecords .ToLinqToDB ().ToString ();
121+      var  productsWithModelCount  = 
122+          from  p  in  ctx .Products 
123+          select  new 
124+          {
125+              //  Window Function
126+              Count  =  Sql .Ext .Count ().Over ().PartitionBy (p .ProductModelID ).ToValue (),
127+              Product  =  p 
128+          };
129+ 
130+      var  neededRecords  = 
131+          from  p  in  productsWithModelCount 
132+          where  p .Count .Between (2 , 4 ) //  LINQ To DB extension
133+          select  new 
134+          {
135+              p .Product .Name ,
136+              p .Product .Color ,
137+              p .Product .Size ,
138+              //  retrieving value from column dynamically
139+              PhotoFileName  =  Sql .Property <string >(p .Product , " ThumbnailPhotoFileName"  )
140+          };
141+ 
142+      //  ensure we have replaced EF context
143+      var  items1  =  neededRecords .ToLinqToDB ().ToArray ();       
144+      
145+      //  async version
146+      var  items2  =  await  neededRecords .ToLinqToDB ().ToArrayAsync (); 
147+      
148+      //  and simple bonus - how to generate SQL
149+      var  sql  =  neededRecords .ToLinqToDB ().ToString ();
142150}
143151``` 
144152
@@ -165,9 +173,11 @@ Below is a list of providers, that should work right now:
165173-  Oracle
166174-  SQL Server CE
167175
168- # Know  limitations 
176+ # Known  limitations 
169177-  No Lazy loading
170178-  No way to work with in-memory database
179+ -  No TPT (table per type) support
180+ -  No many-to-many support
171181
172182# Help! It doesn't work!  
173183
0 commit comments