Skip to content

Commit

Permalink
Removed unecessarry private methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
JimBobSquarePants committed Nov 19, 2012
1 parent db189aa commit 052aa5f
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 28 deletions.
Binary file modified EFBootstrap.suo
Binary file not shown.
26 changes: 1 addition & 25 deletions EFBootstrap/CodeFirst/CodeFirstReadOnlySession.cs
Expand Up @@ -119,7 +119,7 @@ public CodeFirstReadOnlySession(DbContext context)
/// <typeparam name="T">The type of entity for which to provide the method.</typeparam> /// <typeparam name="T">The type of entity for which to provide the method.</typeparam>
public T First<T>(Expression<Func<T, bool>> expression) where T : class, new() public T First<T>(Expression<Func<T, bool>> expression) where T : class, new()
{ {
return this.Any(expression).FirstOrDefault(expression); return this.Any(expression).FirstOrDefault();
} }


/// <summary> /// <summary>
Expand Down Expand Up @@ -207,30 +207,6 @@ protected virtual void Dispose(bool disposing)
} }
#endregion #endregion
#endregion #endregion

#region Private
/// <summary>
/// Returns the name of the type retrieved from the context.
/// </summary>
/// <returns>The name of the type retrieved from the context.</returns>
/// <typeparam name="T">The type of entity for which to provide the method.</typeparam>
/// <remarks>
/// 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)
/// </remarks>
private string GetSetName<T>()
{
PropertyInfo entitySetProperty =
this.context.GetType().GetProperties()
.Single(p => p.PropertyType.IsGenericType && typeof(IQueryable<>)
.MakeGenericType(typeof(T)).IsAssignableFrom(p.PropertyType));

return entitySetProperty.Name;
}
#endregion
#endregion #endregion
} }
} }
2 changes: 1 addition & 1 deletion EFBootstrap/CodeFirst/CodeFirstSession.cs
Expand Up @@ -103,7 +103,7 @@ public CodeFirstSession(DbContext context)
/// <typeparam name="T">The type of entity for which to provide the method.</typeparam> /// <typeparam name="T">The type of entity for which to provide the method.</typeparam>
public T First<T>(Expression<Func<T, bool>> expression) where T : class, new() public T First<T>(Expression<Func<T, bool>> expression) where T : class, new()
{ {
return this.Any(expression).FirstOrDefault(expression); return this.Any(expression).FirstOrDefault();
} }


/// <summary> /// <summary>
Expand Down
2 changes: 1 addition & 1 deletion EFBootstrap/DbFirst/DbFirstReadOnlySession.cs
Expand Up @@ -118,7 +118,7 @@ public DbFirstReadOnlySession(ObjectContext context)
/// <typeparam name="T">The type of entity for which to provide the method.</typeparam> /// <typeparam name="T">The type of entity for which to provide the method.</typeparam>
public T First<T>(Expression<Func<T, bool>> expression) where T : class, new() public T First<T>(Expression<Func<T, bool>> expression) where T : class, new()
{ {
return this.Any(expression).FirstOrDefault(expression); return this.Any(expression).FirstOrDefault();
} }


/// <summary> /// <summary>
Expand Down
2 changes: 1 addition & 1 deletion EFBootstrap/DbFirst/DbFirstSession.cs
Expand Up @@ -102,7 +102,7 @@ public DbFirstSession(ObjectContext context)
/// <typeparam name="T">The type of entity for which to provide the method.</typeparam> /// <typeparam name="T">The type of entity for which to provide the method.</typeparam>
public T First<T>(Expression<Func<T, bool>> expression) where T : class, new() public T First<T>(Expression<Func<T, bool>> expression) where T : class, new()
{ {
return this.Any(expression).FirstOrDefault(expression); return this.Any(expression).FirstOrDefault();
} }


/// <summary> /// <summary>
Expand Down

0 comments on commit 052aa5f

Please sign in to comment.