Attributes not added.

Gentle.NET Forum

Attributes not added.

Postby BertusVanZyl on Fri Jul 15, 2005 6:37 am

I'm not even sure if this is a problem, but here goes...

When generating from an Access DB, it doesn't add the descriptions, like Primary Key, and Foreign Key to the code. (The attributes.)

It does add the NotNull attribute, as well as the TableColumn attribute.

I have the relations set up in Access before generating the code.

Is the template supposed to generate these attributes in the code? If it doesn't, it would definitely be a feature to work on...
BertusVanZyl
Lurker
 
Posts: 7
Joined: Fri Jul 15, 2005 6:13 am

Postby mike.griffin on Fri Jul 15, 2005 6:42 am

I've alerted Angelo, the template author, he knows more about this than I do, we'll get you an answer.
User avatar
mike.griffin
Site Admin
 
Posts: 3290
Joined: Sat Apr 03, 2004 6:10 am
Location: Indianapolis, IN

Postby BertusVanZyl on Fri Jul 15, 2005 7:39 am

Dont worry, I have found the solution. In the default database page, I have not set up the Database target correctly.

I have another problem though, it generated the following code:

Code: Select all
/// <summary>
/// Return list of referenced objects from n:m relation with
/// table \"Quote\", using relation table \"QuoteDetail\"
/// </summary>
public IList referencedQuoteUsingQuoteDetail()
{
   return new GentleList( typeof(Quote), this, typeof(QuoteDetail));
}

/// <summary>
/// Return list of referenced objects from n:m relation with
/// table \"Product\", using relation table \"QuoteDetail\"
/// </summary>
public IList referencedProductUsingQuoteDetail()
{
   return new GentleList( typeof(Product), this, typeof(QuoteDetail));
}
#endregion


The problem is that there are two methods with the same name, as well as the same parameters....
Maybe I should select another db target setting? (relizing as I type)......

Anyway, ill post again if this is the case.
BertusVanZyl
Lurker
 
Posts: 7
Joined: Fri Jul 15, 2005 6:13 am

Postby BertusVanZyl on Fri Jul 15, 2005 7:55 am

This code was generated:

Code: Select all
// generate a static property to retrieve all instances of a class that are stored in the database
      [Visible(false)]
      static public IList ListAll()
      {
         if( listAllCache == null || invalidatedListAll )
         {
            listAllCache = Broker.RetrieveList( typeof(QuoteDetail) ) as ArrayList;
            invalidatedListAll = false;
         }
         return listAllCache;
      }


The problem is that it does not compile. The compiler sais that the Visible attribute can only be applied to properties, and this is a method.

By the way, I really apreciate what you guys are doing with these free tools. Great stuff.

Is there a bug list for the template itself where I can post? I realise this might be the perfect place to place these posts...
BertusVanZyl
Lurker
 
Posts: 7
Joined: Fri Jul 15, 2005 6:13 am

Primary key has wrong TableColumn mapping

Postby BertusVanZyl on Fri Jul 15, 2005 10:50 am

The following code was generated:

Code: Select all
[TableColumn(\"ChildID\", NotNull = false), PrimaryKey(AutoGenerated = true)]
protected int invoiceID;


This tells the system to map to the ChildID column in the Access DB, even though the name of the column is actually \"InvoiceID\".

The primary key of many of the tables has a TableColumn attribute of \"ChildID\" in stead of the actual primary key column's name, where others are not.

I am happy to mail you the actual Access DB mdb file, so that you can generate the code yourself and try and figure out what's shaking.

Thanks for your time. Cheers.
BertusVanZyl
Lurker
 
Posts: 7
Joined: Fri Jul 15, 2005 6:13 am

Postby angelo on Fri Jul 15, 2005 6:41 pm

Hey Bertus,

Please do mail me the MDB, and if possible a DDL script.

Angelo
Vision without action is a daydream, action without vision is a nightmare...
User avatar
angelo
Major General
 
Posts: 159
Joined: Mon Jul 12, 2004 8:17 pm
Location: Best, The Netherlands

Postby angelo on Mon Jul 18, 2005 7:11 pm

Bertus,

My guess is that you are using version 44g_JC, which is an untested version
with a number of changes that are targeted to the way of working of the guy that changed it (Claudio). I still (after 3 months) have to go through that version to decide what parts are going to be part of the 'official' template.
Please switch to 44g, which is supposed to be in the MyGeneration distribution - if not, you can get it from the TemplateLibrary on the MyGeneration site.

Using version 44g:
- I can't reproduce the duplicate referencedQuoteUsingQuoteDetail generation, so that should be OK
- I don't get Visible on the ListAll, this version does not use the Visible property
- The key problem also does not occur on my system, but I did get something similar when I ran 44g_JC

Let me know if 44g fixes your problems, as I would expect. If not, I'll do some more debugging tomorrow.

Angelo

P.s. I could have asked by e-mail, but I want to use the forum archive for reference on these bugs.
Vision without action is a daydream, action without vision is a nightmare...
User avatar
angelo
Major General
 
Posts: 159
Joined: Mon Jul 12, 2004 8:17 pm
Location: Best, The Netherlands

Tried out 44g....

Postby BertusVanZyl on Tue Jul 19, 2005 5:38 am

I have tried out 44g, and you were right. The problem where the variable was mapped to the wrong DB column is not present in 44g. The visible problem seems to be fixed as well. The duplicate method problem is still there though. I have emailed you the code generated by 44g, as well as the actual template code, since it might be possible that I have a slightly different 44g. (?) The DB I have mailed has not changed.
Evil always contain the seed of its own downfall.
BertusVanZyl
Lurker
 
Posts: 7
Joined: Fri Jul 15, 2005 6:13 am

Postby angelo on Tue Jul 19, 2005 5:55 pm

I just did a quick run. Funny: if I select table Quote as the only table to generate, and then select QuoteDetail as a relation table, I only get one referringQuoteParent. If I don't select the relation table, I get the duplicate method problem you reported. Will be doing some debugging later tonight I guess. Hopefully I can find the problem, because I'll be on holidays from tomorrow - will be back on Monday, though.


As for versions: there is only one 44g, that's the one on the template library.

Angelo

P.S. I made picture of a 'Varkoorplakkie' plant once, but I don't know it's English name. Do you? ;-)
Vision without action is a daydream, action without vision is a nightmare...
User avatar
angelo
Major General
 
Posts: 159
Joined: Mon Jul 12, 2004 8:17 pm
Location: Best, The Netherlands

Postby mike.griffin on Tue Jul 19, 2005 6:15 pm

Are you guys using the 113 beta? We modified our ForeignKey logic, if you have time you can go back and check wtih 112 but my bet is that isn't the problem. I just want to throw that out there.
User avatar
mike.griffin
Site Admin
 
Posts: 3290
Joined: Sat Apr 03, 2004 6:10 am
Location: Indianapolis, IN

Postby angelo on Tue Jul 19, 2005 6:19 pm

Hey Mike, stop throwing things out here - don't you have a bin in there? ;-)
I'll have a look with 112 if I can't spot the problem, but this has been reported before, so I doubt if I need to go back
Vision without action is a daydream, action without vision is a nightmare...
User avatar
angelo
Major General
 
Posts: 159
Joined: Mon Jul 12, 2004 8:17 pm
Location: Best, The Netherlands

Postby angelo on Sat Jul 30, 2005 9:09 pm

Just to keep interested folks up to date, some things have been communicated via e-mail instead of the forum. I found a problem with some of the relation-related (nice word, dude ;-) ) logic, but it will take some lead time to fix, since I have to do this after work hours.

Angelo
Vision without action is a daydream, action without vision is a nightmare...
User avatar
angelo
Major General
 
Posts: 159
Joined: Mon Jul 12, 2004 8:17 pm
Location: Best, The Netherlands


Return to Gentle.NET

Who is online

Users browsing this forum: No registered users and 0 guests