I have a website with dynamic data and entity framework setup. It is listing and showing all the table data.
Now I want to add some metadata classes to it. So I have the following:
<MetadataType(GetType(UserMetaData))> _
Partial Public Class User
Public Overrides Function ToString() As String
Return Forename & " " & Surname
End Function
End Class
My problem is that, even though the Forename and Surname is part of the User table, I get the error :
'Forename' is not declared. It may be inaccessible due to its protection level.
How do I correct this?
I miss a time when programmers were real programmers, and not drag and drop artists!!
To be honest, I am not trying to implement the a custom property. I am trying to pass a UI hint using the meta data. So my code is really the following:
<MetadataType(GetType(UserMetaData))> _
Partial Public Class User
End Class
Public Class UserMetaData
<UIHint("myPropertyField")> _
Public myProperty As String
End Class
My problem is that DD just doesnt seem to load my custom field control for myPropertyField. So I was using the custom property to try debug this.
I miss a time when programmers were real programmers, and not drag and drop artists!!
jagdipa
Star
8583 Points
2016 Posts
Dynamic data metadata - property is not declared
Feb 12, 2013 09:26 AM|LINK
I have a website with dynamic data and entity framework setup. It is listing and showing all the table data.
Now I want to add some metadata classes to it. So I have the following:
<MetadataType(GetType(UserMetaData))> _ Partial Public Class User Public Overrides Function ToString() As String Return Forename & " " & Surname End Function End ClassMy problem is that, even though the Forename and Surname is part of the User table, I get the error :
'Forename' is not declared. It may be inaccessible due to its protection level.
How do I correct this?
sjnaughton
All-Star
27391 Points
5485 Posts
MVP
Re: Dynamic data metadata - property is not declared
Feb 12, 2013 05:24 PM|LINK
sorry Jagdipa, but cstom properties are not yet supported in DD with Entity Framework, this is an entity framwwork issue,
Always seeking an elegant solution.
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Dynamic data metadata - property is not declared
Feb 13, 2013 07:32 AM|LINK
Hi jagdipa,
Please change your "Forname" to public, which can be accessed by outside publish program files.
jagdipa
Star
8583 Points
2016 Posts
Re: Dynamic data metadata - property is not declared
Feb 13, 2013 08:26 AM|LINK
To be honest, I am not trying to implement the a custom property. I am trying to pass a UI hint using the meta data. So my code is really the following:
<MetadataType(GetType(UserMetaData))> _ Partial Public Class User End Class Public Class UserMetaData <UIHint("myPropertyField")> _ Public myProperty As String End ClassMy problem is that DD just doesnt seem to load my custom field control for myPropertyField. So I was using the custom property to try debug this.
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Dynamic data metadata - property is not declared
Feb 14, 2013 09:04 AM|LINK
Hi,
You can try to change the String to Object.