Friday, February 17, 2017

LLBLGenPro Lite with PostgreSQL and .Net

In this example I used:

LLBLGenPro Lite Version 5.1 (5.1.2) RTM - LITE  Build Date 24-Jan-2017, Licensee: LITE user
Npgsql -Version 3.1.10
CsvHelper -Version 2.16.3
log4net -Version 2.0.7
Visual Studio 2012 with Package Manager Console Host Version 2.8.60318.667

Few tips:

1. Generic part of adapter source code and DB Specific part ( Projects LLBLGenProLite51DBSpecific & LLBLGenProLite51Generic) were created following "LLBLGen Pro Runtime Framework v5.1 Documentation" documentation at llblgen.com/Documentation/5.1/LLBLGen%20Pro%20RTF/index.htm
bitbucket.org/hemantup/orm/src/upgrade3/LLBLGenProLite51/LLBLGenProLite51.llblgenproj is the saved project of LLBLGenPro.exe which may be used to regenerate the classes later, if need be.
llblgen.com/Documentation/5.1/LLBLGen%20Pro%20RTF/Tutorials%20And%20Examples/tutorial_createproject.htm

2. The only tweak I had to do to generate the source code (on the top the instructions as mentioned in online help guide "LLBLGen Pro Runtime Framework v5.1 Documentation):
a) Put Npgsql.dll in C:\Program Files (x86)\Solutions Design\LLBLGen Pro v5.1\
b) Some of you might also have to put DbProviderFactories entry under LLBLGenPro_x86.exe.config.
Otherwise you may get error:
Exception details:
=====================
Message: Failed to find or load the registered .Net Framework Data Provider.
Source: System.Data
Stack trace: 
   at System.Data.Common.DbProviderFactories.GetFactory(DataRow providerRow)
   at SD.LLBLGen.Pro.DBDriverCore.DBDriverBase.GetDbProviderFactory()
   at SD.LLBLGen.Pro.DBDriverCore.ConnectionDataBase.get_FactoryName()
   at SD.LLBLGen.Pro.Gui.Controls.WizardPages.MetaDataRetrievalWizard_Step_ConnectionData.<LoadDriverAndConnectionControl>b__16_1()
   at SD.LLBLGen.Pro.Gui.Classes.ApplicationIdleDispatcher.PerformWork()
   at SD.LLBLGen.Pro.Gui.Classes.ApplicationIdleDispatcherSingleton.Application_Idle(Object sender, EventArgs e)
   at System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FDoIdle(Int32 grfidlef)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
   at SD.LLBLGen.Pro.Gui.Classes.GuiController.PerformAddMetaDataFromDatabaseAction()
   at SD.LLBLGen.Pro.Gui.Controls.ProjectExplorer._mainBarManager_ItemClick(Object sender, ItemClickEventArgs e)
   at DevExpress.XtraBars.BarItem.OnClick(BarItemLink link)
   at DevExpress.XtraBars.BarButtonItem.OnClick(BarItemLink link)
   at DevExpress.XtraBars.BarItemLink.OnLinkClick()
   at DevExpress.XtraBars.BarButtonItemLink.OnLinkAction(BarLinkAction action, Object actionArgs)
   at DevExpress.XtraBars.ViewInfo.BarSelectionInfo.UnPressLink(BarItemLink link)
   at DevExpress.XtraBars.Controls.CustomLinksControl.OnMouseUp(MouseEventArgs e)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at DevExpress.XtraBars.Controls.CustomControl.WndProc(Message& msg)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Inner exception: <null>

3. In the Console project I created, I had to make DbProviderFactories entry in app.config in addition to installing Npgsql.

For other details, you may refer to comments in bitbucket.org/hemantup/orm/src/upgrade3/LLBLGenProLite51/LLBLGenProLite51Console/Program.cs in sample code.



Working sample code is available at bitbucket.org/hemantup/orm/src/upgrade3/LLBLGenProLite51/






This post is related to https://hemantrohtak.blogspot.com/2016/03/is-entity-framework-best-performing.html



No comments:

Post a Comment