Passing entities in via constuctor PersistenceSpecification
Hi People,
Is it possible to do something like this?
new PersistenceSpecification<Account>(Session)
.CheckProperty(a => a.Name, account.Name)
.CheckList(a => a.Users, a => new List<User>
{
new User(a) { Login = "test1" },
new User(a) { Login = "test2" },
new User(a) { Login = "test3" }
})
.VerifyTheMappings();
So the instace can be passed into the construtor of the entity, allowing for read-only properties?
I had a go at trying to create and extension, but had trouble accessing the entity instance to be able to invoke the function. Also I dont 100% understand how the Func<> and expression classes are being used.
Thanks!
Maxus
Support Staff 2 Posted by James Gregory on 05 Nov, 2010 01:51 PM
I've not seen anyone do that, but that isn't to say you can't!
Your best bet is to take a look at the source code for our existing methods and see what you can find out from there. The
PersistenceSpecification
was contributed by another developer, so I'm not intimately aware of how it works, but I can probably answer questions.3 Posted by Maxus on 06 Nov, 2010 07:43 AM
Hi James,
Thanks will take a look.
Really great work with fluent.
Cheers,
Maxus