This project has moved and is read-only. For the latest updates, please go here.

Safedatareader

Jun 6, 2013 at 7:05 PM
Hi,

When I try to generate CSLA40 data access layer code, I get following.

/// <summary>
    /// Loads a <see cref="Claim"/> object from the given SafeDataReader.
    /// </summary>
    /// <param name="dr">The SafeDataReader to use.</param>
    private void Fetch(SafeDataReader dr)
    {
        // Value properties
        LoadProperty(ClaimIdProperty, data.ClaimId);
        LoadProperty(ClaimNameProperty, data.ClaimName);
        LoadProperty(ActiveProperty, data.Active);
        var args = new DataPortalHookArgs(dr);
        OnFetchRead(args);
    }
It is using data.ClaimId, instead of using data reader to load the property.

Am I missing anything?

Thanks,
Sandeep
Jun 7, 2013 at 12:18 AM
Hi Sandeep,

Your question is "slightly" missing context. What CslaGenFork version? What Csla target? Is it using DAL? What's the object stereotype? Can I have a DB schema and a project file? But before answering those questions, are you sure you are using the proper template version for the CslaGenFork version you are running?

Regards,
Tiago Freitas Leal
Jun 7, 2013 at 10:37 AM
Had exactly the same problem yesterday.

Project Properties->Generation->Target

By default, even though 'Target Framework' defauts to CSLA40, 'Use DTO (instead of Data Reader)' is ticked (although it is grayed out/disabled).

To fix:
Change 'Target Framework' DropDown to CSLA40DAL
You can then untick 'Use DTO (instead of Data Reader)'
Maybe also worth unticking 'Generate DAL interface' and 'Generate DAL' in case they also cause problems
Then change 'Target Framework' DropDown back to CSLA40

Regenerate and all should be ok.

Tiago - Can you check the coding in GetReaderAssignmentStatement

Bill
Jun 11, 2013 at 12:32 AM
Hi Bill,

Thanks for providing the workaround and spot the the problem location.

Regards,
Tiago Freitas Leal