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

linq2db, using DataConnection as abstract class

I am trying to use the DataConnection class of linq2db in an abstract base class like so: public abstract class BaseDbDao : DataConnection where T : IDatabase { public string DBName => DBContext.Database; public T DBContext { get; } …
Sam
  • 602
  • 9
  • 21
0
votes
1 answer

Linq2Db - The ConnectionString property has not been initialized

I have a solution containing separate project (Linq2Db) than the Mvc Asp.Net Core project. In my startup.cs I have followed instructions found on linq2db github explaining how to set connection string, but once I execute a linq query I am receiving…
0
votes
1 answer

Modify Type Name in Linq2DB Templates Generation

I'm trying to scaffold an existing database using the LinqToDB templates. All of the tables in the database have a prefix of "tbl", i.e "tblPerson". I would like to strip this (and other prefixes) from my type names. I tried modifying the…
Paul B
  • 11
  • 1
0
votes
0 answers

What causes the rollback of changes in postgres with asp net core?

My web application has many methods that open the context to the database. As an ORM quality, I use a linq2db. When I try to update some existing record in the database, it seems to me that a rollback occurs. But For some time in the database the…
0
votes
1 answer

Map only 2 specific stored procedure and a table in linq2db t4

I've a quite huge database,which scripted with t4 generates around 30k lines of code. Since this application only uses 2 stored procedure, is there a way to tell at t4 generator to process just the specific stored procedure name I need to map? I…
advapi
  • 3,661
  • 4
  • 38
  • 73
0
votes
1 answer

Linq2db entity framework update query for dynamic table and column

I want a generic query for all the tables using linq2db.EntityFrameworkCore I have 5 things. 1. TableName 2. ColumnaName 3. ColumnValue 4. Where condition column name 5. Where condition column value. So far what I am trying practically is…
Anonymous Creator
  • 2,968
  • 7
  • 31
  • 77
0
votes
1 answer

Setting Linq2Db to read and update with CHAR type and NOT NULL constraint in Oracle

Reading value of fixed CHAR string from table, using Linq2db Oracle provider: CREATE TABLE mytable (pk NUMBER(15,0) NOT NULL, fixed_data CHAR(20) DEFAULT ' ' NOT NULL) Although in database, length…
0
votes
1 answer

linq2db insert or query is returning error: Connection option 'datasource' is duplicated

I have a simple table which I can perform Inser and Read operations using MySQL Commands. For some reason, when using Linq2DB I get the following ERROR: Connection option 'datasource' is duplicated. at…
0
votes
1 answer

How to group by date while taking into account the timezone in linq2db (CONVERT_TZ)?

Say we have a list of activities, for different clients, saved by date. The date is saved in utc, and we know the client's timezone. We want to know the amount of activies per day, in the client's timezone, while taking into account daylight saving…
Mnemo
  • 103
  • 7
0
votes
1 answer

How to map aggregation to a single table with linq2db

I would like to map an object, containing an aggregated instance of another object, to a single table. I have two POCOs like: [Table(Name = "TheTable")] class A { [Column(Name = "PropA"), NotNull] public string PropA { get; set; } public B…
Marcus
  • 30
  • 1
  • 9
0
votes
1 answer

linq2db 3.0.0-preview.1 not working with .net core 3

linq2db 3.0.0-preview.1 isn't working with .net core 3, showing error: System.ArgumentException: 'UdtTypeName' is not a member of type System.Data.SqlClient.SqlParameter' (Parameter 'propertyOrFieldName') While the same thing works great on .net…
0
votes
0 answers

Create Association in class without creating extra columns in database

I have three classes: University, Faculty and Subject and relationship between them: public class University { public University() { Faculties = new List(); } public int Id { get; set; } …
0
votes
1 answer

Execute Queries on SAP Hana without model mapping

I'm developing a .net core application in which I want to access data from external SAP Hana Databases. Since I only want to execute Queries on the SAP Hana Database I am not able to have a referencing model in my .net core application. Since the…
FBeMu6E4
  • 1
  • 1
0
votes
2 answers

Why is Linq2DB executing SQL-Statement after disposing DataContext

I have tested the following code with Linq2DB: IQueryable entities = null; using (var context = new DataContext("MySql", ConnectionString)) { entities = context.GetTable(); } var list = entities.ToList(); return entities; I wonder…
BennoDual
  • 5,865
  • 15
  • 67
  • 153
0
votes
1 answer

Linq2DB Add Property to Model

Consider a simple model class and repository like this: public class User { [Column, Nullable] public string Username { get; set; } [Column, Nullable] public string Status { get; set; } [Column, Nullable] public bool Expired { get; set;…
Matt McNabb
  • 362
  • 4
  • 15