Any Idea What's Causing This Mapping Error?

Apr 6, 2011 at 11:00 PM

After many days of successfully using nHydrate, I'm suddenly getting hit with the following error message whenever I try to access anything off of the entity context object (I've interleaved notes where I can). To be clear, no errors are being generated during the generation phase or during the database installer update phase. This exception only, and always, occurs the first time you try to use access any of the properties or methods on the entity context object.

Schema specified is not valid. Errors: 

JumpForJoySoftware.T2T.EFDAL.T2T.msl(302,7) : error 2009: Content not valid - The conceptual side Member or Property 'Data' specified as part of this MSL does not exist in MetadataWorkspace. Data used to be the CodeFacade name for the property/field data, but I changed them to EncodedData and enc_data, respectively.

JumpForJoySoftware.T2T.EFDAL.T2T.msl(302,7) : error 2010: The Column 'data' specified as part of this MSL does not exist in MetadataWorkspace. It shouldn't because I renamed it.

JumpForJoySoftware.T2T.EFDAL.T2T.msl(313,8) : error 2037: The function parameter data is not defined in the function gen_ContentInsert.

JumpForJoySoftware.T2T.EFDAL.T2T.msl(311,7) : error 2037: A mapping function bindings specifies a function JumpForJoySoftware.T2T.EFDAL.Store.gen_ContentInsert but does not map the following function parameters: ext_path, enc_data, testfield, CreatedDate, CreatedBy, ModifiedBy. enc_data is the new name for data. the other fields are unchanged.

JumpForJoySoftware.T2T.EFDAL.T2T.msl(319,8) : error 2009: The property Data does not exist in the type Content.

JumpForJoySoftware.T2T.EFDAL.T2T.msl(331,8) : error 2037: The function parameter data is not defined in the function gen_ContentUpdate.

JumpForJoySoftware.T2T.EFDAL.T2T.msl(327,7) : error 2037: A mapping function bindings specifies a function JumpForJoySoftware.T2T.EFDAL.Store.gen_ContentUpdate but does not map the following function parameters: ext_path, enc_data, testfield, ModifiedDate, ModifiedBy.

JumpForJoySoftware.T2T.EFDAL.T2T.msl(335,8) : error 2009: The property Data does not exist in the type Content.

JumpForJoySoftware.T2T.EFDAL.T2T.msl(1177,7) : error 2037: A mapping function bindings specifies a function JumpForJoySoftware.T2T.EFDAL.Store.gen_TrusteeInsert but does not map the following function parameters: avatar_id, profile_pic_id, blog_id. those are all fields/properties that I recently added to the schema. they exist in the database.

JumpForJoySoftware.T2T.EFDAL.T2T.msl(1236,7) : error 2037: A mapping function bindings specifies a function JumpForJoySoftware.T2T.EFDAL.Store.gen_TrusteeUpdate but does not map the following function parameters: avatar_id, profile_pic_id, blog_id.

JumpForJoySoftware.T2T.EFDAL.T2T.msl(1295,7) : error 2037: A mapping function bindings specifies a function JumpForJoySoftware.T2T.EFDAL.Store.gen_TrusteeDelete but does not map the following function parameters: Avatarasset_asset_id, ProfilePictureasset_asset_id, Blogasset_asset_id.

????

- Mark

Apr 6, 2011 at 11:10 PM

Some additional info. I don't know anything at all about MSL/CSDL/SSDL files, but I opend up the MSL file and found this section related to the table/entity Content:

<EntitySetMapping Name="Content">
	<EntityTypeMapping TypeName="JumpForJoySoftware.T2T.EFDAL.Entity.Content">
		<MappingFragment StoreEntitySet="content">
			<ScalarProperty Name="AssetID" ColumnName="asset_id" />
			<ScalarProperty Name="ContentID" ColumnName="content_id" />
			<ScalarProperty Name="Data" ColumnName="data" />
			<ScalarProperty Name="IsExternalPath" ColumnName="ext_path" />
			<ScalarProperty Name="CreatedBy" ColumnName="CreatedBy" />
			<ScalarProperty Name="CreatedDate" ColumnName="CreatedDate" />
			<ScalarProperty Name="ModifiedBy" ColumnName="ModifiedBy" />
			<ScalarProperty Name="ModifiedDate" ColumnName="ModifiedDate" />
			<ScalarProperty Name="TimeStamp" ColumnName="TimeStamp" />

So now I can see the problem -- the MSL file description of Content is still referencing the old property/field and CodeFacade names (i.e., data and Data). But why isn't the MSL file getting updated when I change the schema???

Apr 6, 2011 at 11:13 PM

Okay, I tried changing the file extensions on the csdl, msl and ssdl files to see if the generator would regenerate them when it ran.

It did create new csdl and ssdl files.

But it did not create a new msl file.

This is getting weirder and weirder...

Apr 6, 2011 at 11:35 PM

I tried the only thing I could think of -- uninstall nHydrate, install the latest version (I was running 3/20 previously) and try again. Bottom-line, the problem is still there. The MSL file is not being updated.

Along the way I noticed a few oddities:

1) Uninstalling nHydrate didn't empty the WidgetSphere/CodeTools directory. I ended up doing that manually.

2) After installing the 3/28 binaries, upon opening up the solution nHydrate flagged the fact that no generator libraries were installed. I double-clicked on EFDAL, and it trundled along...and along...and along. I finally gave up and forced VS2010 to close. Re-opening the solution seemed to be okay, but you never know.

In any event, I am currently dead in the water with this MSL problem, so if anyone has a quick fix or workaround I would very much like to hear it!!!

- Mark

Apr 6, 2011 at 11:40 PM

I tried modifying a separate nHydrate solution (different schema) to see if its MSL file would get re-generated. It did. So the problem appears to be application-specific.

- Mark

Apr 7, 2011 at 12:08 AM

Okay, I have a workaround, a theory of the problem, and some more information.

I think the problem has to do with the definition for a table getting too large. I'm not sure if I'm running up against a SqlServer limit (e.g., number of bytes per record) or a limit within nHydrate, but eliminating just one field from a particular table definition causes the MSL file to be re-generated when the generator runs.

The table in question, trustee, has the largest number of fields, relations, you name it, in my schema. Which is why I began experimenting on it.

To let you recreate the problem I can send you a zip file of two schemas, a bad one -- which doesn't generate an MSL file -- and a good one, which does. The corresponding CSDL, SSDL and MSL files are also included.

There are only a few differences between the two schemas. The good schema:

1) Has one less field in the trustee table definition (I deleted profile_pic_id in this example, but I've had success deleting any other field, too).

2) Lacks a field called "test_field" in the content table definition (I took this out just to clean stuff up, as I want to continue working on my project). test_field being in or out doesn't affect the good versus bad outcome; I had to delete a field from trustee to solve the problem.

3) I may have changed the CodeFacade name of the enc_data field in the content table between the good and bad versions.

Let me know where to send the file. Also, let me know what your research uncovers. Particularly as to any limits I need to watch out for.

Now it's off to grab a bottle of wine and try to come down off this stress high... :)

- Mark

Apr 7, 2011 at 3:22 AM

Now this is really weird...

After a few hour gap (and without a system reboot), I just went back and added in the field that was causing a problem. And some more fields. And didn't encounter the problem (i.e., the MSL file got regenerated, as expected, every time).

???

- Mark

Coordinator
Apr 13, 2011 at 2:01 PM

Great. I am glad it worked itself out. If this reoccurs let me know and we will address it.