Make sure you are using the assembly that contains the entity class: ActiveRecordStarter.Initialize(typeof(MyClass).Assembly, ActiveRecordSectionHandler.Instance);
2010/12/13 mennodeij <[email protected]> > I have an assembly that contains a class that has the [ActiveRecord] > attribute, but does not inherit from ActiveRecordBase. When I manually > add that class (either by enumerating all classes that thave the > [ActiveRecord] attribute, or by using typeof(MyClass)) the class ends > up in the ActiveRecordStarter.GetRegisteredTypes list. If I only add > the assembly, however, this class does not get added to the list. > > I'm very new to AR and I'm wondering if I do things right here? Is > just adding the [ActiveRecord] attribute enough, or do I need to do > more for proper AR support? Please note that I do not want to inherit > from ActiveRecordBase (base class stealing) and want to persist my > objects using ActiveRecordMediator. > > Example: > > [ActiveRecord] > public class MyClass //no-inherit from ActiveRecordBase > { > [PrimaryKey] > public int ID { get;set;} > [Property] > public int MyProperty { get;set;] > } > > // does not list MyClass (all source is in one assembly for now) > ActiveRecordStarter.Initialize(Assembly.GetExecutingAssembly(),source); > > // does list my class > ActiveRecordStarter.Initialize(source, typeof(MyClass), /*other > classes*/); > > I have further testing code that proves that the class is functional > with AR using ActiveRecordMediator; I can persist and read back > objects. > > Thanks for your input! > > Best wishes, > > Menno > > -- > You received this message because you are subscribed to the Google Groups > "Castle Project Users" group. > To post to this group, send email to [email protected] > . > To unsubscribe from this group, send email to > [email protected]<castle-project-users%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/castle-project-users?hl=en. > > -- Ricardo Borges -- You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=en.
