/// /// Gets a projection of the first {listItemTypeName} occurrence. /// /// The Database context. /// {entityTypeName} lookup key. /// {listItemTypeName} lookup key. /// A projection of {listItemTypeName} public static (bool, {returnTypeFullName}) Get{listItemTypeName}From{entityTypeName} (this {contextFullName} dbContext, {primaryKeyFullName} {primaryKeyVarName}, {listPrimaryKeyFullName} {listPrimaryKeyVarName}) { var query = from mainEntity in dbContext.{propertyName} where mainEntity.{primaryKeyPropertyName} == {primaryKeyVarName} let list = mainEntity.{listPropertyName} from listItem in list where listItem.{listPrimaryKeyPropertyName} == {listPrimaryKeyVarName} select new {returnTypeFullName}(listItem); return (query.Any(), query.FirstOrDefault()); }