Field 'county' of class 'Model.Asset' maps to a master shared column 'CountyCode', but a second master field 'fieldname' uses this column too.
We cannot run the application any longer - any ideas why this might be occurring and didn't before?
county column mapping goes to:
County.countyCode --> CountyCode
and fieldname mapping goes to:
fieldname.countyCode --> CountyCode
fieldname.fieldCode --> FieldCode
Thanks,
Tim
22 Answers, 1 is accepted
I have a base class and a derived class that both have a Location property based on a common _location field. I've done this because the setter needs different behavior in each class. The Location property in the derived class uses the "new" modifier.
The Forward Mapping wizard gives the following error message:
An unexpected error occurred. |
Please contact Telerik support with the following error information: |
Target method: Telerik.OpenAccess.Sdk.IDEMetaData.IMdValue GetClassId() |
Error: Object reference not set to an instance of an object |
I think this is something different and I've fixed the display issue. I guess, there is a real meta data exception in the errors list, that you should check.
Kind regards,
Thomas
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
I've tried using "override" in the derived class property and "virtual" in the base class, but I still get the same error.
Denis
I'm also working with Tim. We are still having issues.
From the support ticket :
1.First of all: Do you want this column to be shared, is it intentional?
2. When a column sharing is intended: Do you really need to expose the same column two times with two reference fields?
1. The answer to this is yes. The county code is a primary key on both reference tables and we can't change this.
2. No. We only need to expose the column once. I changed the countyCode extention to db-ref and received other errors (see below).
I've removed the countyCode and and muniCode fields from the class per Shared Columns . Here are our mappings.
<field name="county">
<extension key="db-column">
<extension key="db-type" value="VARCHAR" />
<extension key="db-column-name" value="CountyCode" />
<extension key="db-length" value="2" />
</extension>
</field>
<field name="municipality">
<extension key="db-ref" value="countyCode">
<extension key="db-column"> *Also Tried <extension key="db-ref">
<extension key="db-type" value="VARCHAR" />
<extension key="db-column-name" value="CountyCode" />
<extension key="db-length" value="2" />
</extension>
</extension>
<extension key="db-ref" value="muniCode">
<extension key="db-column">
<extension key="db-type" value="VARCHAR" />
<extension key="db-column-name" value="MuniCode" />
<extension key="db-length" value="3" />
</extension>
</extension>
</field>
When changing
<extension key="db-ref" value="countyCode">
<extension key="db-column">
<extension key="db-type" value="VARCHAR" />
<extension key="db-column-name" value="CountyCode" />
<extension key="db-length" value="2" />
</extension>
</extension>
To
<extension key="db-ref" value="countyCode">
<extension key="db-ref">
<extension key="db-type" value="VARCHAR" />
<extension key="db-column-name" value="CountyCode" />
<extension key="db-length" value="2" />
</extension>
</extension>
Received Error:
Error executing query: Telerik.OpenAccess.RT.sql.SQLException: Invalid column name 'CountyCode2'.
SQL Generated
FROM [Asset_Assets] a
LEFT JOIN [Municipalities] AS g ON (a.[CountyCode2] = g.[CountyCode] and a.[MuniCode] = g.[MuniCode])
We still don't know what to do other than remove the reference to the Municipalities table and do the join in our LINQ queries manually.
To get around the problem with the "master shared column" error after the Q3 upgrade, I've rebuilt the relationships in this project.
But now a managed collection isn't working, even though it worked with Q2. I've described this in a new thread, "Managed collection for overridden property".
Denis
The simple fix is not to share the columns in the referencing class. This also makes it more logical, because what should happen when the two references are contradictory in that their shared pk value differs? In the past, the internal processing order of the fields determined the outcome (which might have been the right for you). But I will see that we can implement the necessary synchronization code so that such a scenario is possible.
Best wishes,
Thomas
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
this should be fixed in the latest version.
Kind regards,Thomas
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
I've got a UserID column in a table which references Aspnet_Users, but I also have a Profile table which stores Extra info (same GUID)...I want this Residents table to contain both the AspNetUser and Profile object so I have access to properties from both places...
Server Error in '/' Application.
Field 'profile' of class 'CPSDAL.ResidentSchedule'
is the master of a shared column 'userID', but a second reference field
'user' tries to master this column too.
Columns can only be shared
between a simple and a reference field. Usually, the reference field is
the master and the simple field is the slave.
Description: An unhandled exception occurred during
the execution of the current web request. Please review the stack trace
for more information about the error and where it originated in the
code.
Exception Details: Telerik.OpenAccess.Exceptions.MetadataException: Field 'profile' of class 'CPSDAL.ResidentSchedule' is the master of a shared column 'userID', but a second reference field 'user' tries to master this column too.
Columns can only be shared between a simple and a reference field. Usually, the reference field is the master and the simple field is the slave.
Source Error:
Line 116: Database db = Database();
Line 117:
Line 118: IObjectScope newScope = db.GetObjectScope();
Line 119: return newScope;
Line 120: }
|
Source File: c:\Code\CPSLite\web\CPSLite\App_Code\ObjectScopeProvider1.cs Line: 118
Stack Trace:
[MetadataException: Field 'profile' of class 'CPSDAL.ResidentSchedule' is the master of a shared column 'userID', but a second reference field 'user' tries to master this column too. Columns can only be shared between a simple and a reference field. Usually, the reference field is the master and the simple field is the slave.] Telerik.OpenAccess.RT.ExceptionWrapper.Throw() +13 OpenAccessRuntime.storagemanager.StorageManagerFactoryBuilder.createSmfForURL() +678 OpenAccessRuntime.storagemanager.StorageManagerFactoryBuilder.createStorageManagerFactory() +370 OpenAccessRuntime.DataObjects.PersistenceManagerFactoryImp.createStorageManagerFactory() +387 OpenAccessRuntime.DataObjects.PersistenceManagerFactoryBase.init() +754 OpenAccessRuntime.DataObjects.PersistenceManagerFactoryImp.init() +61 OpenAccessRuntime.DataObjects.BootstrapPMF.getPersistenceManagerFactory(IDictionary props) +310 Telerik.OpenAccess.RT.Helper.getPersistenceManagerFactory(IDictionary props) +952 Telerik.OpenAccess.RT.DatabaseAdapter.AssertPersistenceManagerFactory(String usr, String password, Boolean open) +1455 Telerik.OpenAccess.RT.DatabaseAdapter.GetObjectScope(TransactionProvider provider) +38 Telerik.OpenAccess.Database.GetObjectScope() +26 ObjectScopeProvider1.GetNewObjectScope() in c:\Code\CPSLite\web\CPSLite\App_Code\ObjectScopeProvider1.cs:118 ObjectScopeProvider1.GetPerRequestScope(HttpContext context) in c:\Code\CPSLite\web\CPSLite\App_Code\ObjectScopeProvider1.cs:140 Helper.get_Scope() in c:\Code\CPSLite\web\CPSLite\App_Code\Helper.cs:37 App_Master_Modal.Page_Unload(Object sender, EventArgs e) in c:\Code\CPSLite\web\CPSLite\App_Master\Modal.master.cs:21 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +42 System.Web.UI.Control.OnUnload(EventArgs e) +11026878 System.Web.UI.Control.UnloadRecursive(Boolean dispose) +154 System.Web.UI.Control.UnloadRecursive(Boolean dispose) +307 System.Web.UI.Page.UnloadRecursive(Boolean dispose) +24 System.Web.UI.Page.ProcessRequestCleanup() +55 System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +11041050 System.Web.UI.Page.ProcessRequest() +91 System.Web.UI.Page.ProcessRequest(HttpContext context) +240 ASP.residents_aspx.ProcessRequest(HttpContext context) in c:\Windows\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files\root\4d426c4a\7e11f606\App_Web_ppoamr_w.2.cs:0 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +599 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +171 |
Version Information: Microsoft .NET Framework Version:2.0.50727.4927; ASP.NET Version:2.0.50727.4927
you are right, and I apologize for giving you a false hope: Fields cannot be shared yet between >1 reference fields. The reason is, that the synchronization code would be quite complex.
My approach would be to use a second Guid field and perform the necessary synchronization manually; In your case with the ASP user this should not be hard (I guess the id is never changing).
Kind regards,
Thomas
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
I had same error but I got the solution to this error .... for tghis u have to map the column in different way...see below the part of app.config file
<field name="programproject">
<extension key="db-ref" value="programProjectKey">
<
extension key="db-column">
<
extension key="db-column-name" value="PROGRAMPROJECTKEY" />
</
extension>
</
extension>
</field>
<field name="programProjectKey">
<
extension key="db-column">
<extension key="db-column-name" value="PROGRAMPROJECTKEY" />
</
extension>
</field>
Regards,
Dev
This problem still exists, any plans yet to manage it?
I am afraid that this functionality will not be provided soon. Even if this is possible, it would require major changes in the runtime and considerable time to implement. Unfortunately at the moment our development is focused on tasks with higher priority.
Best wishes,
Alexander
the Telerik team
I am not able to give you an exact time-frame but I doubt that this will be implemented for Q3 or earlier this year.
Greetings,
Alexander
the Telerik team
My current project is to build a viewer on top of a legacy database having a lot of multi column primary keys and same column may be part of several foreign key relations.
Questions:
1. How can I model associations to avoid the observed error in my setting?
2. Is the "mapping solution" explained in a previous posting still applicable using the new API?
Kind regards
Arnvid
My current project is to build a viewer on top of a legacy database having a lot of multi column primary keys and same column may be part of several foreign key relations.
Questions:
1. How can I model associations to avoid the observed error in my setting?
2. Is the "mapping solution" explained in a previous posting still applicable using the new API?
Kind regards
Arnvid
Unfortunately this problem has not been solved yet. We have prepared an article with instructions how to avoid this behavior with the current versions - you can find it here.
I hope that helps.
Regards,
Alexander
the Telerik team
NEW and UPDATED OpenAccess ORM Resources. Check them out!
Kind regards
Arnvid
Unfortunately those options would not solve your issue, this is a limitation of OpenAccess ORM runtime. The only solution is to modify the database schema.
We apologize for the inconvenience caused.
Ivailo
the Telerik team
NEW and UPDATED OpenAccess ORM Resources. Check them out!