Questions tagged [linq2db]

LINQ to DB is a fast LINQ database access library offering a simple, light, fast, and type-safe layer between your POCO objects and your database.

LINQ to DB is a fast LINQ database access library offering a simple, light, fast, and type-safe layer between your POCO objects and your database.

Architecturally it is one step above micro-ORMs like Dapper, Massive, or PetaPoco, in that you work with LINQ expressions, not with magic strings, while maintaining a thin abstraction layer between your code and the database. Your queries are checked by the C# compiler and allow for easy refactoring.

However, it's not as heavy as LINQ to SQL or Entity Framework. There is no change-tracking, so you have to manage that yourself, but on the plus side you get more control and faster access to your data.

See Wiki for more details.

Code examples and demos can be found here.

183 questions
1
vote
0 answers

how to set SQLite COLLATE NOCASE colum using linq2db with CreateTable?

Please help me how to set column collation if table is created from class definition using linq2db ? I'm using linq2db 2.6.3 to get data from SQLite local application database There is a work mode in the application that creates database if it does…
oleksa
  • 3,688
  • 1
  • 29
  • 54
1
vote
2 answers

How to make full text search with Linq2db?

I have .Net Core 2.2 project with Linq2db provider for MySql. How can I make search using full text index with linq2db? Is it possible to make for any DB Engine, not DB specific code?
Dmitrij Polyanin
  • 485
  • 5
  • 23
1
vote
1 answer

Linq2DB and Insert a new item with an identity

I've moved an old portion of code from EF to linq2db and when I had to add a new item with an identity that was referenced by inner element I had to perform the following code if (axAnag == null) { axAnag = new…
advapi
  • 3,661
  • 4
  • 38
  • 73
1
vote
1 answer

linq2db with 2 different Databases to migrate a database

I want to migrate a database from Firebird to MSSQL using linq2db in C#. I thought I could load the structure using T4 Models from Firebird and then create the tables and BulkCopy the the data to MSSQL. So far so good, but it is copying data back to…
Flo s
  • 51
  • 5
1
vote
4 answers

Linq select all and additional calculated field

I would like to generate a select statement similar to a sql select: public partial class Person{ public string Name {get;set;} public string FirstName{ get;set;} public string DisplayName {get;set;} public string Town{get;set;} …
Franki1986
  • 1,320
  • 1
  • 15
  • 40
1
vote
1 answer

GroupBy date portion of DateTime in Linq2db.MySQL C#

I am trying to group by the date portion of a DateTime in Linq2db.MySQL. My first attempt is: using (var db = MySqlTools.CreateDataConnection(connectionString)) { { var query = from t in db.GetTable() …
Gerry
  • 129
  • 2
  • 13
1
vote
1 answer

Automating query mapping with multiple joins via Linq2Db

I've been using BLToolkit for a while, and lately I've been testing Linq2Db as the author recommends. I've been able to recreate most of the automations I did for BLToolkit, but I'm struggling to create a standard structure to query for data with…
rualmar
  • 229
  • 2
  • 8
1
vote
1 answer

Linq2Db / Access - error with anonymous group by multiple fields

I have 2 tables: pob (with results of some activities) and names (with user data). I try to select top 5 users from table pob based on their last activity date. So I inner join names and pob, then select top 5 users based on calculated…
yarecky
  • 97
  • 8
1
vote
2 answers

linq2db specify custom conversions for fields going to / from the database to convert to/from specific C# types

In the database we have to work with (which is DB2) there are fields stored as character but are in fact other objects, the most common being custom ways the underlying application stores dates and times. For example: [Table] public class…
Thomas F.
  • 766
  • 10
  • 17
1
vote
3 answers

linq2db .NET ORM partial updates?

We use Linq2DB ORM library for our .NET ORM models see https://github.com/linq2db/linq2db How to send update with only changed columns? Now the SQL query includes all of the columns and values
sergpy
  • 96
  • 6
0
votes
1 answer

LinqToDB.LinqToDBException error in group by linq query in nopcommerce

Here is my group by query var query = ( from fee in _walletRepository.Table group fee by fee.PartyId into groupResult select new { partyId = groupResult.Select(x => x.PartyId), Balance = groupResult.Sum(f =>…
s.k.Soni
  • 1,139
  • 1
  • 19
  • 37
0
votes
1 answer

linq2db integration with Entity Framework Core and dbContext.GetCte missing

linq2db has possibility to "integrate" with EF Core context: EF Core integration In your code you need to initialize integration using following call: LinqToDBForEFTools.Initialize(); but after only that line there is no method GetCte in EF Core…
Artur
  • 95
  • 9
0
votes
1 answer

Linq query with optional join on table using .NET, LinqToDB & Postgresql

What I want to accomplish; A scout can create reports. The scout is the creator of the report. We display the reports that this scout has created in a table. The very same scout can be given access to a report that someone else has created. All…
0
votes
0 answers

How to add dynamic orderby expression into query?

I have dynamic order by expression. I have 2 paramter, one is order by and order by direction. When I am passing orderby orderBy, orderDirec it will not work. Can you please help me, how to do order by with 2 paramter? public async…
Vishal Kiri
  • 101
  • 1
  • 1
  • 9
0
votes
0 answers

linq2db. select into clause

I'm using LINQ to DB (linq2db, linq2db.EntityFrameworkCore) and want to use "select into" clause to create new table from query. Something like this: SELECT * INTO #TempTable FROM SourceTable My classes: public class TempTable { public long Id…
Aries
  • 433
  • 7
  • 17