I designed a database, generated c# code with sqlmetal, and it all works.
Now, I'm working on a UI, and I want to add some attributes to the classes created by sqlmetal.
after reading this SO Q&A: Can I define properties in partial classes, then mark them with attributes in another partial class? and this atrticle: MSDN - MetadataTypeAttribute Class I tried the following:
[MetadataType(typeof(GUI.metadata.BooksMetaData))]
public partial class Book
{
public void fun()
{
}
}
namespace GUI.metadata
{
public class BooksMetaData
{
[DisplayName("hello")]
public object Shelf { get; set; }
}
}
I checked if VS reconizes the attributes of Book in the function fun, and it dosen't, so I'm not suprised that the DisplayName attribute made no change.
what I'm doing wrong and how to fix it?
(I'm using c#, VS 2010 pro and the code generated by sqlmetal is in a different .dll than the GUI is in)