How do I attach generated code to my existing project?

Posts   
 
    
JustinN avatar
JustinN
User
Posts: 11
Joined: 29-Jun-2008
# Posted on: 06-Jul-2008 19:52:05   

Hey all,

I've pointed LLBLGen to my Database, told it to only read 5 tables for a small test, no stored procs or views, just tables.

I compiled the "DatabaseSpecific" project in the output code, and then added references to the three DLL's into my Web Application, after which I added the following code to my Default.aspx.cs file:

using VVM_DAL; using VVM_DAL.DatabaseSpecific; using SD.LLBLGen.Pro.ORMSupportClasses;

I now have no clue how to reference my tables, could somebody help me out please? One of the tables was named "vmm_Vehicle".

I am using:

LLBLGen Pro Version 2.6 Final (June 6th, 200sunglasses - Evaluation Copy

Once I have come to grips on the usage of VMM, I'm pretty sure I'll end up buying a license, so all help is appreciated!

Regards, Justin

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 06-Jul-2008 20:39:54   

These are the basic namespaces you have to add so you can do the basic stuff:

using VVM_DAL;
using VVM_DAL.DatabaseSpecific;
using VVM_DAL.EntityClasses;
using VVM_DAL.FactoryClasses;
using VVM_DAL.HelperClasses;
using VVM_DAL.RelationClasses;

using SD.LLBLGen.Pro.ORMSupportClasses;

Then you can instantiate an fetch your entities:

public void FetchTest()
{
     DataAccessAdapter adapter = new DataAccessAdapter();
     VMMVehicle myVehicle = new VMMVehicle(2542);
     adapter.FetchEntity(myVehicle);

     Console.WriteLine("Vehicle's model: {0}", myVehicle.Model);
}

For more info, read the manual an let us know if we can help you further wink

David Elizondo | LLBLGen Support Team
JustinN avatar
JustinN
User
Posts: 11
Joined: 29-Jun-2008
# Posted on: 06-Jul-2008 21:03:13   

Hey daemo,

Thanks for the swift reply! Unfortunately the following namespaces do not exist:

using VVM_DAL.EntityClasses; using VVM_DAL.FactoryClasses; using VVM_DAL.HelperClasses; using VVM_DAL.RelationClasses;

Am I missing something? The three DLL's I have referenced are:

SD.LLBLGen.Pro.DQE.SqlServer.NET20.dll SD.LLBLGen.Pro.ORMSupportClasses.NET20.dll VVM_DALDBSpecific.dll

Regards, Justin

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 06-Jul-2008 21:32:33   

Yes, you are missing to reference the generic project. The generic project should be named VVM.

As you are using Adapter TemplateSet, when you generate code that will generate two projects (DatabaseGeneric and DatabaseSpecific). Here are some instructions

BTW, you don't have to reference SD.LLBLGen.Pro.DQE.SqlServer.NET20.dll at your GUI (WinForms, WebForms, Console, etc) project. Just be sure that this assembly is referenced at your _DBSpecific _project.

Cheers.

David Elizondo | LLBLGen Support Team
JustinN avatar
JustinN
User
Posts: 11
Joined: 29-Jun-2008
# Posted on: 06-Jul-2008 22:52:11   

Hi daelmo,

Thanks for the swift reply, yet again! The generic project reference was the issue, after adding that, everything else fell into place. Thanks for the link to the documentation, however I already saw everything contained in there from the video tutorial, I just never noticed a file from both projects getting added. simple_smile

Problem solved!

Regards, Justin