[Field] public Entity OtherEntity{ get; set;}

doesn't work, on Domain.Build() i get exception "Type 'Entity' is not registered."

But my config containes:

config.Types.Register(typeof(Entity).Assembly, typeof(Entity).Namespace);

How can i declare a field to a general entity?

This thread was imported from our support forum. The original discussion may contain more detailed answer. Original topic by MSE-iT.

asked Nov 04 '08 at 18:13

Editor's gravatar image


One Answer:

The exception seems really rather strange, but the effect is correct: you can't create a reference to general Entity now, since its primary key isn't defined. Or you can consider it has a set of possible primary key types (i.e. keys of all the hierarchies), and thus DO doesn't know how to create an FK pointing to any of them.

We're currently implementing a solution allowing handle this case: it will be possible to declare fields of Key type (or, probably, of Reference<t>). Such fields will be:

  • Transparently persisted as strings to storage

  • A subject for automatic reference removal

  • Supported in queries. Most likely not fully at initial stages, i.e. "entity.KeyField.StringValue" expression will not be translatable, thus it won't be possible to join by "regular key == such field".

answered Nov 05 '08 at 09:42

Alex%20Yakunin's gravatar image

Alex Yakunin

Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

powered by OSQA