Compile Errors

Posts   
 
    
Wylie
User
Posts: 8
Joined: 17-Apr-2006
# Posted on: 19-Apr-2006 03:01:25   

Hi Again,

I'm creating a LLBL DAL (latest trial version from 17 April) for a DotNetNuke 4.0.2 project in VS 2005 on .NET 2.0.

I've read the getting started sections of the documentation and have followed the tutorial videos.

The videos are slightly different from the latest pro version, but I think I'm doing things OK.

I've followed the steps outlined and things compiled fine.

  • I output the generated code into a directory outside of the WebRoot directory tree
  • I have moved the app.config setting to my web.config
  • I've added two projects: MyProject.LLBL.csproj and MyProject.LLBLDBSpecific.csproj
  • I've made references to both of these projects and to SD.LLBLGen.Pro.ORMSupportClasses.NET20 (1.0.20051.60407)

I'm using all the associated class name spaces for good measure.

using SD.LLBLGen.Pro.ORMSupportClasses; using SD.LLBLGen.Pro.DQE.SqlServer; using Interzoic.LLBL.TypedListClasses; using Interzoic.LLBL.DatabaseSpecific; using Interzoic.LLBL.EntityClasses; using Interzoic.LLBL.FactoryClasses; using Interzoic.LLBL.HelperClasses; using Interzoic.LLBL.RelationClasses; using Interzoic.LLBL.ValidatorClasses;

However when I add the code below I get errors. I've looked this over and tried various approaches. What am I missing?

DataAccessAdapter daAdapter = new DataAccessAdapter(); IzmwidgetDalUsersRow rowUser = new IzmwidgetDalUsersRow(ItemId); daAdapter.FetchEntity(rowUser); string sTemp = rowUser.Content;

Errors:

  • The type 'Interzoic.LLBL.TypedListClasses.IzmwidgetDalUsersRow' has no constructors defined

  • The best overloaded method match for 'SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntity(SD.LLBLGen.Pro.ORMSupportClasses.IEntity2)' has some invalid arguments

  • Argument '1': cannot convert from 'Interzoic.LLBL.TypedListClasses.IzmwidgetDalUsersRow' to 'SD.LLBLGen.Pro.ORMSupportClasses.IEntity2'

I'm getting close!

Thanks, Chris

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 19-Apr-2006 03:42:38   
DataAccessAdapter daAdapter = new DataAccessAdapter();
> IzmwidgetDalUsersRow rowUser = new IzmwidgetDalUsersRow(ItemId);
> daAdapter.FetchEntity(rowUser);
> string sTemp = rowUser.Content;

You are trying to access a typedlist. Which needs to be queried as a list and not just the row. You can setup a PredicateExpression that will fill a typedlist with rows that contain ItemID. Also since this a typedlist you will need to use daAdapter.FetchTypedList(list); Try this.

IzmwidgetDalUsersTypedList test = new IzmwidgetDalUsersTypedList();
IPredicateExpression filter = new PredicateExpression();
filter.Add(IzmwidgetDalUserFields.ItemId == 123);/*This needs to reference the table you use in the typed list that contains ItemId*/
using (DataAccessAdapter adapter = new DataAccessAdapter())
{
        adapter.FetchTypedList(test, filter);
}
Wylie
User
Posts: 8
Joined: 17-Apr-2006
# Posted on: 19-Apr-2006 07:43:28   

Thanks!

I had to take a closer look at what is going on.

I first got a simple Entity to work:


DataAccessAdapter adapter = new DataAccessAdapter();
InterzoicWidgetDalEntity entWidgetDal = new InterzoicWidgetDalEntity(ItemId);
adapter.FetchEntity(entWidgetDal);
string sTemp = entWidgetDal.Content;

if (entWidgetDal != null)
{
  txtContent.Text = entWidgetDal.Content;
  ctlAudit.CreatedByUser = entWidgetDal.CreatedByUser.ToString();
  ctlAudit.CreatedDate = entWidgetDal.CreatedDate.ToString();
}

Then I went back for a TypedList. I'll get my naming conventions down better next time!

I'm still having problems.


IzmwidgetDalUsersTypedList tlWidgetDal = new IzmwidgetDalUsersTypedList();
IPredicateExpression filter = new PredicateExpression();
filter.Add( InterzoicWidgetDalFields.ItemId == ItemId);
using (DataAccessAdapter adapter = new DataAccessAdapter())
{
  adapter.FetchTypedList(tlWidgetDal, filter);
}
string sTemp = tlWidgetDal.FieldName;

Problems: 1 - for both IPredicateExpression and new PredicateExpression I get this error: The type 'SD.LLBLGen.Pro.ORMSupportClasses.PredicateExpression' exists in both c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\webroot\dd395b12\588677bc\assembly\dl3\38799bc5\00a8f800_845dc601\SD.LLBLGen.Pro.ORMSupportClasses.NET20.DLL c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\webroot\dd395b12\588677bc\assembly\dl3\7b831190\00c702fb_835dc601\SD.LLBLGen.Pro.ORMSupportClasses.CF11.DLL

I've tried deleting the temp directory, but the errors return.

2 - While writing the code tlWidgetDal. (note the . ) does not return IntelliSense for any of the field names from the 2 tables I used to create the typedlist.

3 - From my initial posting on this thread - what using namespaces do I need to include?

Thank you very much. We're making progress. This is really a great product.

One more question if I may. What percentage of people do you think are using the SelfServicing vs. Adapter? What's your preference?

Thanks, Wylie

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 19-Apr-2006 08:39:48   

ORMSupportClasses.CF11.DLL is the runtimeLibrary used for the compact Framework, it sems that you refer to this dll by mistake, or you generated your code for a compact Framework.

What generator configuration and template set did you use to generate your code?

2 - While writing the code tlWidgetDal. (note the . ) does not return IntelliSense for any of the field names from the 2 tables I used to create the typedlist.

This might disappear after a rebuild.

3 - From my initial posting on this thread - what using namespaces do I need to include?

You might need all of them, all of them are valid, it depends on whether you are gonna use them all or not. You may start not using any of them and add them one by one as you need them, a compilation errors will guide you.

Wylie
User
Posts: 8
Joined: 17-Apr-2006
# Posted on: 19-Apr-2006 18:27:14   

Thanks for helping me get a leg up on this.

I don't know how the Compact Framework dll got in my bin, but after I deleted it things are working fine.

I've got things cooking with both Entities and TypedLists.

This is a great product and the customer support is terrific.

Have a good day.

Wylie