CodeSmith Community
Your Code. Your Way. Faster!

null date issue

Latest post 04-24-2007 9:42 AM by smallinov. 6 replies.
  • 04-10-2007 4:42 PM

    • basolutions
    • Top 100 Contributor
    • Joined on 03-21-2007
    • Denver, CO
    • Posts 51
    • Points 1,175

    null date issue

    All,

    I have a field called SynchDate in my Accounts table, which orignally was declared as not nullable.  Once we started working the saves for this table, we realized that the field needed to be nullable.  I tried changing the field to nullable, but the regen did not pick it up, so the declartion in the entity looked like: 

    public System.DateTime SynchDate = null

    Which results in this error:  Cannot convert null to 'System.DateTime' because it is a value type (path)\Entities\AccountsBase.generated.cs 2469 44 (namespace).Entities

    I tried adding new nullable fields and those worked just fine.  Ultimately, I had to rename the field from SychDate to CrmSynchDate and it finally worked.  Any thoughts on why this would occur?  Is SynchDate a reserved netTiers/CodeSmith word?

    Thanks,

    Jesse

    • Post Points: 35
  • 04-11-2007 11:20 AM In reply to

    Re: null date issue

    no, it's not a reserved word.  It's likely you were just working with a cached schema during the time you were working on the issue. 
    http://community.codesmithtools.com/forums/permalink/23674/23679/ShowThread.aspx#23679

    Robert Hinojosa
    -------------------------------------
    Member of the Codesmith Tools, .netTiers, teams
    http://www.nettiers.com
    -------------------------------------
    • Post Points: 35
  • 04-11-2007 11:46 AM In reply to

    • basolutions
    • Top 100 Contributor
    • Joined on 03-21-2007
    • Denver, CO
    • Posts 51
    • Points 1,175

    Re: null date issue

    Robert,

    It defnitely was not a schema cache issue.  I added and subtracted fields which generated correctly while the SynchDate field did not.  I will investigate it some more.

    Thanks.

    • Post Points: 35
  • 04-11-2007 11:53 AM In reply to

    Re: null date issue

    There's a chance it might've been the mapping file as well. It
    probably did not update the mapping file rendered to the root of the
    project. Try updating that by hand.

    On 4/11/07, basolutions wrote:
    >
    >
    > Robert,
    >
    > It defnitely was not a schema cache issue. I added and subtracted fields
    > which generated correctly while the SynchDate field did not. I will
    > investigate it some more.
    >
    > Thanks.
    >
    >
    >

    Robert Hinojosa
    -------------------------------------
    Member of the Codesmith Tools, .netTiers, teams
    http://www.nettiers.com
    -------------------------------------
    • Post Points: 35
  • 04-24-2007 9:26 AM In reply to

    Re: null date issue

    I just ran into this issue as well. Instead of updating the Mapping .config file by hand I renamed it so that I could compare the results if it worked. The update did indeed work and the difference is "System.DateTime?" vs. "System.DateTime"....which makes sense but this begs the question ..Why didn't the Mapping.config file update?

    -Ryan

    • Post Points: 35
  • 04-24-2007 9:32 AM In reply to

    Re: null date issue

    Well, because it would potentially overwrite someone's customization to the mapping file.  It's difficult to allow the flexibility of mapping, and always be able to update changes.  We just haven't gotten to that point yet.

    There is a standalone template:
    \SchemaMapping\CreateNetTiersSchemaMap.cst  that will recreate the mapping without regenerating the whole thing that you can use to diff the maps and easily update.


    On 4/24/07, smallinov <bounce-smallinov@codesmithsupport.com> wrote:

    I just ran into this issue as well. Instead of updating the Mapping .config file by hand I renamed it so that I could compare the results if it worked. The update did indeed work and the difference is "System.DateTime ?" vs. "System.DateTime"....which makes sense but this begs the question ..Why didn't the Mapping.config file update?






    Robert Hinojosa
    -------------------------------------
    Member of the Codesmith Tools, .netTiers, teams
    http://www.nettiers.com
    -------------------------------------
    • Post Points: 35
  • 04-24-2007 9:42 AM In reply to

    Re: null date issue

    What if there was an attribute added to elements that the user has hand modified.

      <Column Id="DueDate" CSType="System.DateTime?" PropertyName="DueDate" FieldName="dueDate" FriendlyName="Due Date" IncludeInOutput="true" Modified=True/>

    It seems like something like this could alleviate this problem. Also, if I didn't specify a path for the mapping file I wouldn't run into this problem correct?

    -Ryan

    • Post Points: 5
Page 1 of 1 (7 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems