Menu
  • HOME
  • TAGS

optional include with entity framework

linq,entity-framework,include,loading,eager

I don't have access to Visual Studio to confirm but you will probably find that assigning the return from the call to Include will sort it - it will be something like a QueryObject that implements IQueryable var Database = new Entities(); IQueryable<Department> result = Database.Departments; if (includeHospitalEmployee) { result...

Laravel 5 Eager Loading not working

php,loading,laravel-5,eager

You have to declare the relationship methods as public. Why is that? Let's take a look at the with() method: public static function with($relations) { if (is_string($relations)) $relations = func_get_args(); $instance = new static; return $instance->newQuery()->with($relations); } Since the method is called from a static context it can't just call...

Can Try be lazy or eager in Scala?

scala,lazy-evaluation,lazy-initialization,eager

Yes, it wouldn't be hard to write LazyTry. One possible approach: sealed class LazyTry[A](block: => A) { // the only place block is used private lazy val underlying: Try[A] = Try(block) def get = underlying.get def isSuccess = underlying.isSuccess ... } object LazyTry { def apply[A](block: => A): LazyTry[A] =...

NHibernate iStatelessSession returns duplicate parent instances on eager fetch

nhibernate,fluent-nhibernate,fetch,eager,istatelesssession

I would say: Do not use StatelessSession. It does not suite to this use case. 13.2. The StatelessSession interface Alternatively, NHibernate provides a command-oriented API that may be used for streaming data to and from the database in the form of detached objects. A IStatelessSession has no persistence context associated...