I have a lot of code, especially in tests, that looks like this pattern...
var someEntity = new SomeClass {
// set props
};
_session.Store(someEntity);
// do more stuff with someEntity
What would be kinda nice if I could do this:
var someEntity = _session.Store(new SomeClass {
// do more stuff with someEntity
This would save a bunch of lines of code. Alternatively, maybe this?
var someEntity = new SomeClass {
// set props
}.Store(_session);
// do more stuff with someEntity
This style could be done with an extension method that doesn't change the existing API. Thoughts? Do either of these make the code better or worse?