Using two Different DAL Generated Projects in a Solutions

Posts   
 
    
mdavis
User
Posts: 2
Joined: 06-May-2011
# Posted on: 13-May-2011 15:52:54   

Hello,

I'm new to working with LLBLGen Pro and I'm working on a Web Project where there is a DAL project that was generated using version 2.6 of your product. There is a huge amount of exsisting code that uses this DAL with version (SD.LLBLGen.Pro.ORMSupportClasses.NET20, Version=2.0.0.0). We upgraded to version 3.1 of you product which uses ((SD.LLBLGen.Pro.ORMSupportClasses.NET20, Version=3.0.0.0). We generated a different DAL with only the new tables which weren't in the original DAL. The reason being was because of the time contraints and not wanting to go back and refactor all of the code just for the few new tables. I can add the new DAL to the solution and I have no problem compiling. All exsisting codes still works fine call code in the OLD DAL project, but when I call a function on the same page that exsist in the new DAL. I get an error saying that it can't load the new version of the dll(3.0.0.0) in the assembly. I know why because of version (2.0.0.0) is already loaded. But I don't get this error until runtime. Is there a way to make this work and have two different assembly references in the project? Where I can reference two different version of the DAL project in my Web Project or do I have to regenerate the whole DAL project just to include the new tables. This will cause me to have to refactor all of the code and that is not an option at this time. Here is the error below. Thanks experts for any help in advance.

**Could not load file or assembly 'SD.LLBLGen.Pro.ORMSupportClasses.NET20, Version=3.0.0.0, Culture=neutral, PublicKeyToken=ca73b74ba4e3ff27' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) **

0x80131040) Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileLoadException: Could not load file or assembly 'SD.LLBLGen.Pro.ORMSupportClasses.NET20, Version=3.0.0.0, Culture=neutral, PublicKeyToken=ca73b74ba4e3ff27' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

**Source Error: **

Line 23: Line 24: Return PlportalFeatureCollection.GetMultiAsDataTable(filter, MaxResults, sort) Line 25: End Function Line 26: Line 27: End Module

Source File: C:\G5_032411\PLFeature\HelperClasses\DataLib.vb Line: 25

Assembly Load Trace: The following information can be helpful to determine why the assembly 'SD.LLBLGen.Pro.ORMSupportClasses.NET20, Version=3.0.0.0, Culture=neutral, PublicKeyToken=ca73b74ba4e3ff27' could not be loaded.

=== Pre-bind state information === LOG: User = COMMERCIAL\mdavis LOG: DisplayName = SD.LLBLGen.Pro.ORMSupportClasses.NET20, Version=3.0.0.0, Culture=neutral, PublicKeyToken=ca73b74ba4e3ff27 (Fully-specified) LOG: Appbase = filedisappointed //Cdisappointed G5_032411/PLWebv4/ LOG: Initial PrivatePath = C:\G5_032411\PLWebv4\bin

Calling assembly : PLFeatureDAL, Version=1.0.4149.12585, Culture=neutral, PublicKeyToken=null.

LOG: This bind starts in default load context. LOG: Using application configuration file: C:\G5_032411\PLWebv4\web.config LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config. LOG: Post-policy reference: SD.LLBLGen.Pro.ORMSupportClasses.NET20, Version=3.0.0.0, Culture=neutral, PublicKeyToken=ca73b74ba4e3ff27 LOG: Attempting download of new URL filedisappointed //Cdisappointed Windows/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/plwebv4/25c09067/5cb595e6/SD.LLBLGen.Pro.ORMSupportClasses.NET20.DLL. LOG: Attempting download of new URL filedisappointed //Cdisappointed Windows/Microsoft.NET/Framework/v2.0.50727/Temporary ASP.NET Files/plwebv4/25c09067/5cb595e6/SD.LLBLGen.Pro.ORMSupportClasses.NET20/SD.LLBLGen.Pro.ORMSupportClasses.NET20.DLL. LOG: Attempting download of new URL filedisappointed //Cdisappointed G5_032411/PLWebv4/bin/SD.LLBLGen.Pro.ORMSupportClasses.NET20.DLL. WRN: Comparing the assembly name resulted in the mismatch: Major Version ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 13-May-2011 19:37:27   

mdavis wrote:

Is there a way to make this work and have two different assembly references in the project? Where I can reference two different version of the DAL project in my Web Project or do I have to regenerate the whole DAL project just to include the new tables. This will cause me to have to refactor all of the code and that is not an option at this time. Here is the error below. Thanks experts for any help in advance.

AFAIK, there is no a way to do that. Maybe some black magic using .net advance assembly redirects or something like that, but I don't know really.

The ideal option is to update your whole project. If that is not an option because of the time, you can still use your old v2.x code in the meantime and migrate the whole project as a side work. That is what I would recommend.

David Elizondo | LLBLGen Support Team
mdavis
User
Posts: 2
Joined: 06-May-2011
# Posted on: 13-May-2011 21:32:35   

Thanks for the quick answer. I will try the assembly redirects method. If that doesn't work I will do as you say and migrate the code on the side. If I am some how able to pull this off, I will post back here the solutions. Once again, Thanks!