ambiguous reference error when using two db reference

Posts   
 
    
Abrar
User
Posts: 26
Joined: 13-Nov-2009
# Posted on: 25-Nov-2009 18:55:55   

Hi, I am working on a project in which i have to pull data from Oracle and Insert into SQL Server. I have created two LLBLGen projects, each for Oracle and SQL Server. I am referencing the adapter namespaces for each of them. When i am trying to call the EntityCollection it gives me an ambiguous reference error. I know this is because i already have a EntityCollection with Oracle, I cannot call another EntityCollection for SQL Server. I tried using alias namespace then it gives me an error at adapter.FetchEntityCollection by saying "cannot find EntityCollection".

Do you think I'm doing in a right way? or Is there any other way of working on two databases simultaniously without ambiguous reference issue.

Thanks, Abrar

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 26-Nov-2009 04:18:54   

Hi Abrar,

First of all, please post your LLBLGen version and runtime library version (http://llblgen.com/tinyforum/Messages.aspx?ThreadID=7725).

David Elizondo | LLBLGen Support Team
Abrar
User
Posts: 26
Joined: 13-Nov-2009
# Posted on: 30-Nov-2009 14:39:37   

Hi David,

I am using LLBLGen pro version 2.5 and Runtime library version DotNet20. My databases are Oracle 10g and SQL Server 2005. Pulling from Oracle and Inserting in SQl Server. Let me know if you need more info.

Thanks, Abrar

daelmo wrote:

Hi Abrar,

First of all, please post your LLBLGen version and runtime library version (http://llblgen.com/tinyforum/Messages.aspx?ThreadID=7725).

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 30-Nov-2009 15:35:34   

You have posted the same post 4 times!! I'll remove the excess ones.

(EDIT)

I am referencing the adapter namespaces for each of them. When i am trying to call the EntityCollection it gives me an ambiguous reference error.

When using any of the generatred objects (eg. EntityCollection), use a fully qualified name.

If this doesn't solve your problem, please post a code snippet with the appropriate namespace using statments shown.

Abrar
User
Posts: 26
Joined: 13-Nov-2009
# Posted on: 30-Nov-2009 16:06:31   

Hi Walaa, Given below are the namespaces for both projects (Oracle 10g and SQL Server 2005)

Oracle namespaces

using RMSYSBilling.DataAdapter; using RMSYSBilling.DataAdapter.DatabaseSpecific; using RMSYSBilling.DataAdapter.EntityClasses; using RMSYSBilling.DataAdapter.FactoryClasses; using RMSYSBilling.DataAdapter.HelperClasses; using RMSYSBilling.DataAdapter.RelationClasses; using RMSYSBilling.DataAdapter.TypedViewClasses;

Sql Server namespaces

using BillingTrades.DataAdapter; using BillingTrades.DataAdapter.DatabaseSpecific; using BillingTrades.DataAdapter.EntityClasses; using BillingTrades.DataAdapter.FactoryClasses; using BillingTrades.DataAdapter.HelperClasses; using BillingTrades.DataAdapter.RelationClasses;

Code snippet:

using (DataAccessAdapter adapter = new DataAccessAdapter()) {

                EntityCollection<DealTypeEntity> dealEntityColl = new EntityCollection<DealTypeEntity>();

blows-out at DataAccessAdapter and EntityCollection<DealTypeEntity> by throwing this err: 'DataAccessAdapter' is an ambiguous reference between 'RMSYSBilling.DataAdapter.DatabaseSpecific.DataAccessAdapter' and 'BillingTrades.DataAdapter.DatabaseSpecific.DataAccessAdapter'.

and

'EntityCollection' is an ambiguous reference between 'RMSYSBilling.DataAdapter.HelperClasses.EntityCollection<BillingTrades.DataAdapter.EntityClasses.DealTypeEntity>' and 'BillingTrades.DataAdapter.HelperClasses.EntityCollection<BillingTrades.DataAdapter.EntityClasses.DealTypeEntity>'

Thanks, Abrar

Walaa wrote:

You have posted the same post 4 times!! I'll remove the excess ones.

(EDIT)

I am referencing the adapter namespaces for each of them. When i am trying to call the EntityCollection it gives me an ambiguous reference error.

When using any of the generatred objects (eg. EntityCollection), use a fully qualified name.

If this doesn't solve your problem, please post a code snippet with the appropriate namespace using statments shown.

Walaa avatar
Walaa
Support Team
Posts: 14993
Joined: 21-Aug-2005
# Posted on: 30-Nov-2009 16:20:59   

You shouldn't use these using statments at all.

Because for example: when you use DataAccessAdapter in the code, the compiler wouldn't know which of the using statmenets to use for this adapter.

Instead you should directly use the qualifying namespace in code.

Abrar
User
Posts: 26
Joined: 13-Nov-2009
# Posted on: 30-Nov-2009 18:52:11   

Thanks for your help Walaa, Now what about connection string? I have one key(Main.ConnectionString) in my <appSettings> for Oracle connection. Now i want to add another for SQL Server. Can I add one more key or any other way of doing it?

Thanks, Abrar

Walaa wrote:

You shouldn't use these using statments at all.

Because for example: when you use DataAccessAdapter in the code, the compiler wouldn't know which of the using statmenets to use for this adapter.

Instead you should directly use the qualifying namespace in code.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 01-Dec-2009 05:39:17   

Abrar wrote:

Thanks for your help Walaa, Now what about connection string? I have one key(Main.ConnectionString) in my <appSettings> for Oracle connection. Now i want to add another for SQL Server. Can I add one more key or any other way of doing it?

Yes, you can. Here is the how: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=16117&StartAtMessage=0&#90043

David Elizondo | LLBLGen Support Team
Abrar
User
Posts: 26
Joined: 13-Nov-2009
# Posted on: 01-Dec-2009 14:51:56   

Thanks David, That was really easy and helpful.

daelmo wrote:

Abrar wrote:

Thanks for your help Walaa, Now what about connection string? I have one key(Main.ConnectionString) in my <appSettings> for Oracle connection. Now i want to add another for SQL Server. Can I add one more key or any other way of doing it?

Yes, you can. Here is the how: http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=16117&StartAtMessage=0&#90043