Is this the right way to do a console application's data context?
AppTools
.Init("App's daily operations",
false,
new GlobalLogic(),
() => new DataAccessState(cn => cn.Open()));
If not, then how to do it?
Is this the right way to do a console application's data context?
AppTools
.Init("App's daily operations",
false,
new GlobalLogic(),
() => new DataAccessState(cn => cn.Open()));
If not, then how to do it?
If you're talking about a server-side console app, you don't even need to call AppTools.Init
. Here's the correct way:
Program.cs
.In the file, your class should look like this:
partial class Program {
static partial void initGlobalLogic( ref SystemLogic globalLogic ) {
globalLogic = new YourGlobalLogicClass();
}
static partial void ewlMain( string[] args ) {
DataAccessState.Current.PrimaryDatabaseConnection.ExecuteWithConnectionOpen( () => {
// Your code goes here.
// Skip the ExecuteWithConnectionOpen call if you don't need the database.
}
}
}