Avonelle's Tech Blog

Go Back

When BLD DataAnnotation attributes aren’t working…

This is a reminder of things that I should double check when one of my BLD DataAnnotation attributes doesn’t appear to be working. Almost always it is something I’m doing wrong, so here are some things to check. Many of these items relate generally to .NET and how partial classes work, but is important with BLD because they don’t throw errors, just result in things not working.

  • Is the property name in the metadata the same as my LLBLGen class? Remember: with partial classes these must be exact, and it is case sensitive (even in VB.NET).
  • This also applies if it is reference to another table. For example: QuestionEntity references the SectionEntity, and it is named Section in the LLBLGen class, so it must be the same name in the metadata.
  • The BLD business rules classes and the LLBLGen classes have to go into the same project for partial classes to work.
  • Metadata classes execute no code except attributes. So calculated properties have to go into entity tables, not EntityMetadata classes.

Also a useful thing to checkout is the DescriptorsBrowser.aspx page, which will show the attributes that are being added to your entities. I’ve been able to figure out what was going wrong by checking there.

Posted by Avonelle on Friday, January 18, 2013.

Facebook Twitter