Skip to content
This repository has been archived by the owner on Mar 9, 2021. It is now read-only.

V1.2 Fix NCommon without ServiceLocator #36

Open
wants to merge 9 commits into
base: v1.2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions NCommon.Db4o/src/Db4oRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ namespace NCommon.Data.Db4o
/// Inherits from the <see cref="RepositoryBase{TEntity}"/> class to provide an implementation of a
/// repository that uses Db4o.
/// </summary>
public class Db4oRepository<TEntity> : RepositoryBase<TEntity>
public class Db4oRepository<TEntity> : RepositoryBase<TEntity> where TEntity : class
{
readonly IObjectContainer _privateContainer;
protected IObjectContainer _privateContainer;

/// <summary>
/// Default Constructor.
Expand Down
2 changes: 1 addition & 1 deletion NCommon.EntityFramework/src/EFRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ namespace NCommon.Data.EntityFramework
/// </summary>
public class EFRepository<TEntity> : RepositoryBase<TEntity> where TEntity : class
{
readonly IEFSession _privateSession;
protected IEFSession _privateSession;
readonly List<string> _includes = new List<string>();

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion NCommon.LinqToSql/src/LinqToSqlRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace NCommon.Data.LinqToSql
/// </summary>
public class LinqToSqlRepository<TEntity> : RepositoryBase<TEntity> where TEntity : class
{
readonly ILinqToSqlSession _privateSession;
protected ILinqToSqlSession _privateSession;
readonly DataLoadOptions _loadOptions = new DataLoadOptions();

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions NCommon.NHibernate/src/NHRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ namespace NCommon.Data.NHibernate
/// Inherits from the <see cref="RepositoryBase{TEntity}"/> class to provide an implementation of a
/// repository that uses NHibernate.
/// </summary>
public class NHRepository<TEntity> : RepositoryBase<TEntity>
public class NHRepository<TEntity> : RepositoryBase<TEntity> where TEntity : class
{
//int _batchSize = -1;
//bool _enableCached;
//string _cachedQueryName;
readonly ISession _privateSession;
protected ISession _privateSession;

/// <summary>
/// Default Constructor.
Expand Down
2 changes: 1 addition & 1 deletion NCommon/src/Data/IFetchingStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace NCommon.Data
///<summary>
/// Specifies a fetching strategy for a <see cref="IRepository{TEntity}"/> instance.
///</summary>
public interface IFetchingStrategy<TEntity, TForService>
public interface IFetchingStrategy<TEntity, TForService> where TEntity : class
{
///<summary>
/// Instructs the instance to define the fetching strategy on the repository instance.
Expand Down
2 changes: 1 addition & 1 deletion NCommon/src/Data/IRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace NCommon.Data
/// components should implement.
/// </summary>
/// <typeparam name="TEntity">The type of entity that the repository encapsulates.</typeparam>
public interface IRepository<TEntity> : IQueryable<TEntity>
public interface IRepository<TEntity> : IQueryable<TEntity> where TEntity : class
{
/// <summary>
/// Gets the a <see cref="IUnitOfWork"/> of <typeparamref name="T"/> that
Expand Down
2 changes: 1 addition & 1 deletion NCommon/src/Data/InMemoryRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ namespace NCommon.Data
/// </summary>
/// <typeparam name="TEntity">The entity type for which this repository was created.</typeparam>
/// <remarks>This class can be used in Unit tests to represent an in memory repository.</remarks>
public class InMemoryRepository<TEntity> : RepositoryBase<TEntity>
public class InMemoryRepository<TEntity> : RepositoryBase<TEntity> where TEntity : class
{
readonly IList<TEntity> _internal;

Expand Down
4 changes: 2 additions & 2 deletions NCommon/src/Data/RepositoryBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace NCommon.Data
/// A base class for implementors of <see cref="IRepository{TEntity}"/>.
///</summary>
///<typeparam name="TEntity"></typeparam>
public abstract class RepositoryBase<TEntity> : IRepository<TEntity>
public abstract class RepositoryBase<TEntity> : IRepository<TEntity> where TEntity : class
{
/// <summary>
/// Gets the <see cref="IQueryable{TEntity}"/> used by the <see cref="RepositoryBase{TEntity}"/>
Expand Down Expand Up @@ -110,7 +110,7 @@ public virtual T UnitOfWork<T>() where T : IUnitOfWork
Guard.Against<InvalidOperationException>(currentScope == null,
"No compatible UnitOfWork was found. Please start a compatible UnitOfWorkScope before " +
"using the repository.");

Guard.TypeOf<T>(currentScope,
"The current UnitOfWork instance is not compatible with the repository. " +
"Please start a compatible unit of work before using the repository.");
Expand Down
2 changes: 1 addition & 1 deletion NCommon/src/Data/RepositoryWrapperBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace NCommon.Data
/// </summary>
/// <typeparam name="TRepository">The type of repository to wrap.</typeparam>
/// <typeparam name="TEntity">The entity type of the repository.</typeparam>
public abstract class RepositoryWrapperBase<TRepository, TEntity> : IRepository<TEntity> where TRepository : IRepository<TEntity>
public abstract class RepositoryWrapperBase<TRepository, TEntity> : IRepository<TEntity> where TRepository : IRepository<TEntity> where TEntity : class
{
readonly TRepository _rootRootRepository;

Expand Down