Alex of Base4 fame asked some good questions that I thought would be useful to share.
Hmm… so it is an ORM!
Kind of. We prefer to call it a domain model framework as we are equally focusing on things not directly related to ORM; validation & rules, data binding, security etc.
Well well well…. Looks nicely engineered and focused.
Thanks!
I’m very interested in what you are trying to achieve entering this highly competitive space? And creating essentially an ActiveRecord (Castle) clone? Is there some sort of end-game I am missing?
Not really. However, our observation is that there are few areas of software that are not highly competitive :-) Our "value proposition" is based around simplicity, usability and commercial level documentation, support etc.
As an aside, ActiveRecord is one of the more frustrating tools I've used. You not only need to grok ActiveRecord, but NHibernate too!
Also the quickstarts didn’t make it clear can I do this sort of thing:
QueryExpression query = Entity.Attribute( "Author.FirstName" ) == “Alex”;
Book book = Repository<Book>.FindOne(query);
I.e. query through a relationship? Doesn’t seem clear to me how this might work? Seeing as you are saying “AuthorId” should be the name of both the field and the FK?
Yes, this is by convention. For example:
int _authorId;
public int AuthorId { get; set; }
public Author Author { get; set; }
Here is an example query from our test suite:
IList<Contribution> contributions
= Repository.Find<Contribution>(
Entity.Attribute("Comments.Message").Like("J%") ||
Entity.Attribute("Contributor.UserName").Like("a%"));
Can I suggest you put together a few samples outlining how fields that are ForeignKeys (are handled) i.e. LazyLoading, Setting, Getting, Query through?
Yes, we are doing this.
i.e. is this possible?
Author author = book.Author?
Or not?
Yes. Back-ref properties are mandatory and wire-up is automatic.
Do I have to write the Getter and Setter for the property myself?
Yes, although we plan to provide some code gen support for the boiler plate stuff. However, code gen is purely optional.
Do I have to track changes myself?
i.e. return Repository<Author>(Entity.Attribute(“Id”) == _authorId);
OR
Book.Author = new Author();
Do I have to remember to add the new Author to the Repository manually at this point? Even though the Book is already being tracked?
No, but we have a convention around how properties are setup.
Simple attribute properties look like this:
public string Subject
{
get { return _subject; }
set { Set(ref _subject, value, "Subject"); }
}
And, association properties look like this:
public Member Member
{
get { return Get(_member); }
set { Set(_member, value); }
}
Collection properties look like this:
public EntityCollection<Comment> Comments
{
get { return Get(_comments); }
}
So we track changes but are not using proxying. This was a conscious design decision.
All in all very interesting… and I think you should be successful, if you remain highly focused and don’t let power users subvert your mission!!
Cheers
Alex