diff --git a/EFBootstrap.suo b/EFBootstrap.suo index e2b4f67..31d7c51 100644 Binary files a/EFBootstrap.suo and b/EFBootstrap.suo differ diff --git a/EFBootstrap/CodeFirst/CodeFirstReadOnlySession.cs b/EFBootstrap/CodeFirst/CodeFirstReadOnlySession.cs index 6dd1921..62c3719 100644 --- a/EFBootstrap/CodeFirst/CodeFirstReadOnlySession.cs +++ b/EFBootstrap/CodeFirst/CodeFirstReadOnlySession.cs @@ -119,7 +119,7 @@ public CodeFirstReadOnlySession(DbContext context) /// The type of entity for which to provide the method. public T First(Expression> expression) where T : class, new() { - return this.Any(expression).FirstOrDefault(expression); + return this.Any(expression).FirstOrDefault(); } /// @@ -207,30 +207,6 @@ protected virtual void Dispose(bool disposing) } #endregion #endregion - - #region Private - /// - /// Returns the name of the type retrieved from the context. - /// - /// The name of the type retrieved from the context. - /// The type of entity for which to provide the method. - /// - /// If you get an error here it's because your namespace - /// for your EDM doesn't match the partial model class - /// to change - open the properties for the EDM FILE and change "Custom Tool Namespace" - /// Note - this IS NOT the Namespace setting in the EDM designer - that's for something - /// else entirely. This is for the EDMX file itself (r-click, properties) - /// - private string GetSetName() - { - PropertyInfo entitySetProperty = - this.context.GetType().GetProperties() - .Single(p => p.PropertyType.IsGenericType && typeof(IQueryable<>) - .MakeGenericType(typeof(T)).IsAssignableFrom(p.PropertyType)); - - return entitySetProperty.Name; - } - #endregion #endregion } } \ No newline at end of file diff --git a/EFBootstrap/CodeFirst/CodeFirstSession.cs b/EFBootstrap/CodeFirst/CodeFirstSession.cs index 121ee64..63c0342 100644 --- a/EFBootstrap/CodeFirst/CodeFirstSession.cs +++ b/EFBootstrap/CodeFirst/CodeFirstSession.cs @@ -103,7 +103,7 @@ public CodeFirstSession(DbContext context) /// The type of entity for which to provide the method. public T First(Expression> expression) where T : class, new() { - return this.Any(expression).FirstOrDefault(expression); + return this.Any(expression).FirstOrDefault(); } /// diff --git a/EFBootstrap/DbFirst/DbFirstReadOnlySession.cs b/EFBootstrap/DbFirst/DbFirstReadOnlySession.cs index 624329a..03a7e7b 100644 --- a/EFBootstrap/DbFirst/DbFirstReadOnlySession.cs +++ b/EFBootstrap/DbFirst/DbFirstReadOnlySession.cs @@ -118,7 +118,7 @@ public DbFirstReadOnlySession(ObjectContext context) /// The type of entity for which to provide the method. public T First(Expression> expression) where T : class, new() { - return this.Any(expression).FirstOrDefault(expression); + return this.Any(expression).FirstOrDefault(); } /// diff --git a/EFBootstrap/DbFirst/DbFirstSession.cs b/EFBootstrap/DbFirst/DbFirstSession.cs index 6c94046..c4d82fc 100644 --- a/EFBootstrap/DbFirst/DbFirstSession.cs +++ b/EFBootstrap/DbFirst/DbFirstSession.cs @@ -102,7 +102,7 @@ public DbFirstSession(ObjectContext context) /// The type of entity for which to provide the method. public T First(Expression> expression) where T : class, new() { - return this.Any(expression).FirstOrDefault(expression); + return this.Any(expression).FirstOrDefault(); } ///