简体   繁体   中英

DataAnnotations in monodroid

I have some models in a core library I'd like to share with a MonoDroid project, but System.ComponentModel.DataAnnotations is not available to the monodroid target. I tried grabbing the code for System.ComponentModel.DataAnnotations from the mono source and compiling the source code into the project but ended up going into a rabbit hole trying to get it to compile with all it's dependencies.

Anyone have any suggestions or steps on how I can include that namespace in Xamarin monodroid and monotouch projects?

If not, maybe a suggestion on how I can include my model class library in my xamarin projects without build errors.

Soner, it would appear they are still not available at the moment in Xamarin. However, I did not have any issue using DataContract , and DataMember annotations in my Portable Class Libraries. If your not using PCL's I highly recommend it for any code sharing scenarios anyways. Good luck!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM