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
0
votes
2 answers

LINQ multiple joins with different objects

I've been working on a C# program that use LINQ to manage a simple SQLite database. The database consists in different tables that in my code are represented by different classes. This is how I create the tables: public ITable Doctors…
Giulia B.
  • 25
  • 2
0
votes
0 answers

Setting the identifier quote character in Linq2Db

I find it hard to imagine that this question hasn't been asked before, but I couldn't find it. I would like to use Linq2Db for Sybase and I need to change the identifier quoting characters from [ and ] to " and ", which is what Sybase uses. Is there…
John
  • 357
  • 2
  • 7
0
votes
0 answers

Linq2db InvalidCastException when table merging

I'm trying update table Registry with List of my own class objects. I found that I should use temp tables for merge with my collection. var tsource = Content.GroupBy(l => l.CardId).Select(s => new DocumentContent { CardId = s.Key, …
Igor Chemidov
  • 31
  • 1
  • 1
  • 6
0
votes
2 answers

Linq2db (MySQL). Set Row Index

I need to specify the row index for each row (Mysql 5.7 with Linq2db). How can I build a query like SELECT `t`.*, @n:=@n+1 as rank FROM ('some query') `t`, (SELECT @n := 0) `rowcounter` Or how can I do it in another way
0
votes
1 answer

How to use more than one SQLite databases using LinqToDB

I am using LinqToDB and LinqToDB.SQLite to access databases in my app. I have two separate and unique databases in my WPF app. I have two connection strings as such:
Kenny Mann
  • 881
  • 10
  • 28
0
votes
2 answers

linq2db Insert ? error ColumnMapping

I try use linq2db for insert data? but get error Table class [Table(Schema="inf", Name="InformMessageLog")] public partial class InformMessageLog { [Identity ] public int ID { get; set; }// int [Column, …
0
votes
1 answer

How to set linq2db connection string in Azure Function enviroment

I had generate data model from linq2db T4 template and develop and debug my azure function local, setting up connection string in local.settings.json. After deploy function to Azure I set up same connection string to my Azure SQL Database at…
reddto
  • 27
  • 1
  • 1
  • 7
0
votes
1 answer

Linq left outer join with exclusion via Linq2db

Using Linq2db and Ms Access I want to select all sectors that don't have targets ergo I want to execute left outer join with exclusion: Dim q10 = From s In db.Sectors From t In db.Targets.Where(Function(f) f.id_sector =…
yarecky
  • 97
  • 8
0
votes
0 answers

Linq2db.Postgresql SELECT Throws 22021: invalid byte sequence for encoding \"UTF8\": 0xa3

I am using linq2db.postgresql to select data from a table the table includes some unicode in the description field. var dataContext = LinqToDB.DataProvider.PostgreSQL.PostgreSQLTools.CreateDataConnection(_ConnectionString,…
R Davies
  • 105
  • 1
  • 11
0
votes
0 answers

LinqToDB How to use MapValueAttribute in DataParameter

I have enum 'EntityStatus' with MapValue: public enum EntityStatus { [MapValue("")] None, [MapValue("AR")] AwaitingReview, [MapValue("IR")] InReview, [MapValue("RT")] Returned, [MapValue("RS")] Resolved, …
kim3d
  • 1
  • 2
0
votes
1 answer

linq2db "cannot be converted to sql" error

I'm using Linq2db with a custom server-side only function: [Sql.Function(Name = "UniqueValue", ServerSideOnly = true)] public static int? UniqueValue( Expression> arg) { throw new NotSupportedException(); } I…
trs79
  • 309
  • 3
  • 13
0
votes
1 answer

Issue with LinqToDb T4 templates for a SqlLite database (using LoadSQLiteMetadata)

I'm trying to use a local SqlLite database (in my app_data) folder with LinqToDb. Anybody an idea why LinqToDb cannot work with the following connectionstring ?
AardVark71
  • 3,928
  • 2
  • 30
  • 50
0
votes
1 answer

InvalidCastException when retrieving object from sqlite table using Linq2DB

I have a problem trying to get records from a Sqlite table using Linq2db+SQLite, here is my table below CREATE TABLE LogEntry ( Time DATETIME NOT NULL ON CONFLICT ROLLBACK DEFAULT (CURRENT_TIMESTAMP), Reference STRING NOT NULL ON CONFLICT…
0
votes
1 answer

Insert DateTime into SQL Server 2005

How to configure linq2db to use types for SQL Server 2005? Now I'm trying to do an insert command InsertWithIdentity, I get the error: "The version of SQL Server in use does not support datatype 'datetime2'". For DateTime columns I put…
b0bi
  • 623
  • 8
  • 14
0
votes
1 answer

NullReferenceError with linq to PostgreSQL

I have proyect that use linq to postgresql, I have the library and Its three dependencies. But when I try to connect to de DB I get this error: First chance of Exception of type ' System.NullReferenceException ' in linq2db.dll. Additional…
1 2 3
12
13