CodeSmith Community
Your Code. Your Way. Faster!

PATCH: Mapping.config Updates and More

rated by 0 users
This post has 11 Replies | 2 Followers

Top 50 Contributor
Posts 96
Points 2,620

Okay, I think I am ready to submit this for team review (and hopefully inclusion).  This patch is generated against Revision 551.  Here is an overview of what's in this patch:

  • BUG FIX: If you had an index with many fields and long-named fields, you would get stored procedure names that were longer than the 128 character max enforced by SQL Server.  There is a new function GetProcNameForGetByIX() that will return a "full" name if it can.  If the full name would exceede the 128 character limit, it will only include as many index fields as it can fit within the limit.
  • BUG FIX: When sorting a list with no sort specified, the default was to use the textual name of the appropriate list's first column enum entry instead of the actual table/view column name stored in the attribute.  It will now use the appropriate table/view column name from the attribute.
  • BUG FIX: If you have a table/view column named "Environment" it will conflict with "Environment.NewLine".  I made the references to System.Environment.NewLine fully qualified.
  • ENHANCEMENT: The mapping.config file now allows you to specify <View/> elements, which are identicle to <Table/> elements, except that they can only contain <Column/> elements.
  • BUG FIX: The function GetPascalCaseName() was unable to handle input which contained all upper-case letters (i.e. MY_TABLE_NAME).
  • REFACTOR: GetAliasName() claimed in its documentation that it should only be called by wrapper functions, but was scoped public.  I scoped it private and corrected all external calls to use existing or new wrapper functions (i.e. GetClassName, GetPropertyName, GetFriendlyName, etc.).
  • BUG FIX/ENHANCEMENT/REFACTOR: I reworked most of how GetAliasName() used the mapping.config file, including the ability to get view information.  I left the alias file handling alone, except for minor refactoring.
  • REFACTOR: There were two, nearly identicle functions; GetCleanName() and GetCleanName2().  The second was a better RegEx pattern, so I removed the "old" GetCleanName() and renamed GetCleanName2() to now be GetCleanName().
  • BUG FIX: Several calls to GetAliasName() were passing in modified names (i.e. table or column names that had already been "processed" by another function) and not finding these values in the ID attribute.  I changed these calsl to use the *Schema.Name value instead.
  • REFACTOR: The functions GetDBColumnName() and GetPropertyName() were substantially identicle.  GetDBColumnName() is now a wrapper to GetPropertyName().
  • BUG FIX/REFACTOR: Most of the functions that built object property related code (i.e. GetObjectPropertySetBLOCKED EXPRESSION, etc.) were not using the proper GetAliasName() wrappers.  They were also somewhat redundant.
  • ENHANCEMENT/REFACTOR: GetPrivateName() now uses the mapping.config file for views and is reworked to be less redundant.
  • BUG FIX/REFACTOR: GetSqlParameterXmlNode() has several new overloads and now correctly uses the proper "names" when building stored procedure parameters.
  • REFACTOR: Consolodated the two duplicate functions GetKeysName(ColumnSchema[]) and GetKeysName((ColumnSchemaCollection).  One now overloads the other.
  • BUG FIX: If you had a table/view column named "Test" and selected the NUnit framework, the [Test] attribute would not resolve properly.  It now uses the fully-qualified name "NUnit.Framework.Test" if you are using the NUnit framework.
  • ENAHNCEMENT: If you had check constraints on your table columns, the random data generator used to create the mock instance object variables would not take these constraints into account and would generate data that would fail the unit tests.  The generated unit test static functions CreateMockInstance() and UpdateMockInstance() are now named CreateMockInstance_Generated() and UpdateMockInstance_Generated()  and are wrapped with user-modifiable CreateMockInstance() and UpdateMockInstance() functions.  You can manually make sure that any test data confirms to your check constraints in these functions without losing your changes during re-generation.
  • BUG FIX: The entity unit tests were creating their mock objects before creating the transaction.  This was causing child objects to be created outside of the transaction, so their test data was not being removed from the database at the end of the test.

NOTE: There is still a bug with the unit tests when it comes to objects that have child objects of the same type (i.e. you have a User object Employee that has a property called Manager which is of type User) and where that table has a unique constraint one one or more columns.  The reason is that the test data is randomly generated at code-generation time, and so is the same for the Employee and Manager instances.  When it comes time to DeepSave the Employee, the Manager isntance throws a SQL exception for the unique constraint violation.  The solution is to generate the random data at run-time.  I have the functions/mechanism to do this for strings.  Once I have it done for the other data types, I will submit a separate patch.

Please let me know if you find any issues.

  • | Post Points: 65
Top 10 Contributor
Posts 925
Points 35,460

Great work Tony!

As there's quite a lot here and on your other patch I've started a discussion with the other team members to see how we can progress these.

Hopefully we'll be able to get things moving on it. 

swin 

------------------------------------------------- Member of the .NetTiers team -------------------------------------------------
  • | Post Points: 35
Top 50 Contributor
Posts 96
Points 2,620

Sounds good, swin, thanks.

I should point out that I am continuing to fix & refactor items related to mapping.config and other functions I "trip across" in the templates.  Would it help if I were to generate a single patch that included both of my previous patches and my changes in the last day?  I am running through debugging to eliminate compilation errors now.

Tony

  • | Post Points: 35
Top 100 Contributor
Posts 51
Points 1,465

SVN is pretty smart in working out how to merge code. Make a patch of everything that has changed. Then edit your first post in this thread and change the file to your new patch. Don't forget to rename test.patch to test.patch.text

 Regards
   Taliesin

 

  • | Post Points: 35
Top 50 Contributor
Posts 96
Points 2,620

There's your combined patch for mapping.config and EntLib3, both against rev 552.  You still need to make sure you create the file & directory changes to the "References" directory.

Let me know if I can help!

  • | Post Points: 35
Top 10 Contributor
Posts 925
Points 35,460

Good work, thanks Tony!

Patched in at version SVN554

swin

------------------------------------------------- Member of the .NetTiers team -------------------------------------------------
  • | Post Points: 35
Top 50 Contributor
Posts 96
Points 2,620
Fast work!  Thanks to you and the team for hopping on this quick.  It will certianly make my life easier. Smile
  • | Post Points: 5
Top 25 Contributor
Posts 157
Points 4,650

This patch breaks the Alieases file, it totally disregards all entries in the Aliases file.  Needless to say, it just generated most of my entities with the wrong name, which is a royal pain in the ass.  Now I have to go manage the mapping.config file for each entity, for every column??
 

"Small is the number of them that see with their own eyes, and feel with their own hearts" Albert Einstein
  • | Post Points: 35
Top 10 Contributor
Posts 925
Points 35,460

There is a known problem with the pascal casing routine introduced with this update.  I've posted a suggested fix but I was awaiting feedback from the original contributor to make sure it worked with his db.

see http://community.codesmithtools.com/forums/24441/ShowThread.aspx#24441

if I don't get any response back by tomorrow I'll post what I think will fix it.

hth

swin

------------------------------------------------- Member of the .NetTiers team -------------------------------------------------
  • | Post Points: 35
Top 25 Contributor
Posts 157
Points 4,650

swin,

I don't see a patch that will CORRECTLY fix the field name casing issues.  Right now my field names are all screwed up, I have a statusId field in my table and the property name used to be StatusId, which I loved, now it's statusid (which I HATE).

Do you have a fix for this?  If so, can you please post a patch for it? 

"Small is the number of them that see with their own eyes, and feel with their own hearts" Albert Einstein
  • | Post Points: 35
Top 50 Contributor
Posts 96
Points 2,620

My comments are in no way a reflection of anyone's views but my own. 

Lighten up.  It's an open-source development project being worked on by the grace of contributors and the hard work of the core team.  If you aren't prepared to contribute to the fix directly, try offering constructive feedback with details of what it's doing wrong where.  If you can't do either of those things,  go back to the version that was working for you and simply go on with your project.

Your inconsiderate use of text formatting and unconstructive, demanding feedback does nothing but promote the incorrect idea that the work of the NetTiers team is not appreciated or that the efforts of contributors attempting to give back to the product that has made their lives easier are unwelcome.

Tony

  • | Post Points: 35
Top 25 Contributor
Posts 157
Points 4,650

Swin and Tony,

sorry if I came on as a demanding ***, that wasn't my intention at all.  Upon re-reading my post, I can see I should have been more considerate in my use of language and casing.  All I was trying to do was to express what's not working for me, and kindly request a patch, IF one exists.

That's not what my previous post conveyed, for that I apologize, I appreciate this project and everyone working on it more than I can convey in a posting such as this, so please excuse my previous post.

"Small is the number of them that see with their own eyes, and feel with their own hearts" Albert Einstein
  • | Post Points: 5
Page 1 of 1 (12 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems