One or more properties are not registered for this type

One or more properties are not registered for this type

Old forum URL: forums.lhotka.net/forums/t/8603.aspx


FrazerS posted on Wednesday, March 03, 2010

I have read all the posts I can find on this error, but I still cannot see why I am getting this exception.  I have a property which is a ECC.    Here is my property declaration:

 

 

 

 

 

private static PropertyInfo<MailboxList> MailboxesProperty =
               RegisterProperty(typeof(MailboxList), new PropertyInfo<MailboxList>("Mailboxes", "Mailboxes"));
public MailboxList Mailboxes
 {
    get
    {        
       if (!FieldManager.FieldExists(MailboxesProperty))
          LoadProperty(MailboxesProperty, MailboxList.NewMailboxList());
       return GetProperty(MailboxesProperty); 
    }
    set { SetProperty(MailboxesProperty, value); }
  }

This property is declared in a concrete class, derived directly from BusinessBase<T> :

  [Serializable]
  public class Employee : BusinessBase<Employee>, IObjectMapper

(IObjectMapper is just an empty interface through which I apply some extension methods for mapping to and from the data layer.)

When I try to reference this property either directly or through ReadProperty, it throws an InvalidOperationException with the message: "One or more properties are not registered for this type."

The MailboxList class is declared:

    [Serializable()]
    public class MailboxList : Csla.BusinessListBase<MailboxList, Mailbox>

Can anyone see what I am missing here?  My other (non-list) properties register just fine in this class - so what's wrong wth the one which is an ECC?

Frazer

 

ajj3085 replied on Wednesday, March 03, 2010

The first argument of RegisterProperty is the type which OWNS the property... not the type the property will contain.  The T in PropertyInfo<T> describes what type the property holds.  Just remove that parameter completely, so your call is RegisterProperty(new PropertyInfo<MailboxList>("Mailboxes", "Mailboxes"));

FrazerS replied on Wednesday, March 03, 2010

Sheesh.

Thanks, Andy.

cheers,

Frazer

 

ajj3085 replied on Wednesday, March 03, 2010

Hope I didn't come off as harsh or anything, because you're certainly not the first person to have some confusion around this.  I appologize if I did.

Copyright (c) Marimer LLC