I used to use the following to connect to E10, but since switching to Kinetic, this no longer works and I get the error about not finding System.Transactions.Local
Does anyone have a way to connect using LinqPad?
// f4 - added EntityFramework.SqlServer.dll (SERVER/ASSEMBLIES)
void Main()
{
// Change query references to point to the correct Ice.Data.Model.dll and Erp.Data.910100.dll from your server directories (Press F4 or Edit the .linq file).
// Change this to point to your server web.config file
var webConfigFile = @"\\xxx\E10Web\xxxApp\Server\web.config";
InitialiseConfiguration(webConfigFile);
//
// Enable for 10.2 Only
EpiProviderRegistrator.Register();
//
var Db = new ErpContext();
Db.Part.Where(p=>p.Company == "xxx" && p.TrackLots == true).Dump();
}
private void InitialiseConfiguration(string webConfigPath)
{
// Resetting is based on http://stackoverflow.com/questions/6150644/change-default-app-config-at-runtime
AppDomain.CurrentDomain.SetData("APP_CONFIG_FILE", webConfigPath);
typeof(ConfigurationManager)
.GetField("s_initState", BindingFlags.NonPublic |
BindingFlags.Static)
.SetValue(null, 0);
typeof(ConfigurationManager)
.GetField("s_configSystem", BindingFlags.NonPublic |
BindingFlags.Static)
.SetValue(null, null);
typeof(ConfigurationManager)
.Assembly.GetTypes()
.Where(x => x.FullName ==
"System.Configuration.ClientConfigPaths")
.First()
.GetField("s_current", BindingFlags.NonPublic |
BindingFlags.Static)
.SetValue(null, null);
//ConfigurationManager.ConnectionStrings.Dump();
}
I have System.Runtime.dll in there. If anyone know what references I need for Kinetic in linqpad … that’s what is needed. I am missing something. Thanks!
i did not try .NET 6 server with linqpad, but just from looking on the screen I can tell, that you will have to rewrite this.
easy part - settings are now in host.config, not web.config
.NET (Core) does not use AppDomain at all.
Also Configuration manager was changed beween .NET Framework and .NET Core.
So probably it would be easier to start from scratch - create new .NET project and try to use ERP DataModel first, then add additional code you need.