fmwviormv / sqlite-net

Automatically exported from code.google.com/p/sqlite-net
0 stars 0 forks source link

Attributes not recognized when declared in an external assembly (class library) #37

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I stumbled on this via the following scenario:  A client > server app with each 
application sharing a class library to define the data types to be exchanged 
via custom serialization.  A class defined in that shared library (let's call 
it "Command") has a primary key with the [PrimaryKey, AutoIncrement] 
attributes.  When creating the table from either application, using "Command" 
as the type, the field that *should* be a PK is simply defined as an integer.  
Additional investigation shows that none of the attributes are interpreted 
correctly in this situation.

Since storing the exchanged "command" only occurs on the server side, I simply 
created a wrapper class declared in the server project, that inherited from 
"Command" as a base class, and the table created correctly.

IMHO, this is a hindrance for anyone working with cross platform data exchange 
where the data is to be cached on either side.  When searching for attributes, 
you may want to enumerate all assemblies?  Something like that - I've done it 
for custom attributes associated to design-time editors in Visual Studio, but 
that's probably a different story :-)

Original issue reported on code.google.com by rnende...@gmail.com on 26 Jun 2011 at 8:15