LinqToDB: How to change connection string, or set it without using project's configuration

linq2db/examples
linq2db update columns
linq2db query syntax
linqtodb loadwith
linq2db join example
linq to database

https://github.com/linq2db/linq2db I need to use different connection strings and can't find how to make it.

I found a solution. It's not very nice. (I use firebird):

public FirebirdDatabaseContext(IDataProvider provider, string connectionString):base(provider, connectionString){}

Used an overload with IDataProvider. When creating a FirebirdDatabaseContext need to directly pass new FirebirdDataProvider() as first argument, and a connection string as second.

LINQ to DB, LINQ to DB is the fastest LINQ database access library offering a simple, light, fast, and There is no change-tracking, so you have to manage that yourself, but on the In your web.config or app.config make sure you have a connection string And later just set on program startup before the first query is done (​Startup.cs  LINQ to DB. LINQ to DB is the fastest 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.

You can use DataConnection.AddConfiguration(...) and DataConnection.SetConnectionString(...) to add new or change existing connection strings in linq2db.

Init DataConnection without config · Issue #12 · linq2db/linq2db , Right now, to do this I have to have a (factory) method that sets all this up. working together to host and review code, manage projects, and build software together. The problem is that the setters for ConnectionString are DataProvider are private. If these could be change to protected then it would work. Make sure you have using LinqToDB; at the top of your class. This syntax works: Two lambdas one for the property selector and second for the value. db.Product.Where(x => x.ProductID == 1).Set(x => x.Name, x => "ABC"); You are going to face a hard time with IntelliSense using this method, unless you right two empty lambadas Set(x=> , x=>),

how to insert or update without null properties · Issue #2050 , Connect with others public class Person { public string Name{get;set;} public string School{get any ideas to skip null property value on insert or update ?? If I insert a entity without set value to the field which has default value in db. how can i make the database default value work in linq2db ? thanks! LINQ to DB is the fastest 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.

LINQ to SqlServer, SqlServer nuget to the project. Modify the connection settings in the T4 template to connect to your database. Add connection string to the web/app.​config file: If it's set to True, LINQ to DB will throw an exception if it can't convert a method to and linq2db would do the mapping for you without the need for using the  The best way to read the app.config connection string c#, then change the connection string dynamically for sqldatasource during run time. Get and set c# application settings in runtime and learn

Change LINQ Connection String Dynamically with Programming , This tip shows how to change LINQ-to-SQL connection string at Sometimes, needs of the programming projects are on changing App.config Setting string that you may want to change without having to change code. To save a connection string directly into application settings. In Solution Explorer, double-click the My Project icon (Visual Basic) or Properties icon (C#) to open the Project Designer. Select the Settings tab. Enter a Name for the connection string. Refer to this name when accessing the connection string in code. Set the Type to (Connection string).

Use the connectionString from your app's config file in Reporting , Then override the ConnectionString provided by the DataSet with the one specified in your config file: Configuration" is not referenced by default (as it is in a web project). This name should not change while the string itself can be different. The way we set the connectionstring for our report (we use typed datasets btw)  I'm new to Asp.Net MVC. My question is how to change DefaultConnection in the web.config file to use my entity framework connection string. my goal is one database in whole application. I'm using Asp.Net MVC 5, and entity framework database first. the other posts I found here, doesn't specify my problem correctly.

Comments
  • I don't want to place over 200 connection string in config, because they differ only by ID.
  • You can create a config file , where you can store all of your connection strings and reference it once in your web.config Check my edits