diff --git a/src/Volo.Abp.ApplicationContracts/Volo/Abp/Application/Services/Dtos/EntityDto.cs b/src/Volo.Abp.ApplicationContracts/Volo/Abp/Application/Services/Dtos/EntityDto.cs
index 7fab20c981..f9b8664a2b 100644
--- a/src/Volo.Abp.ApplicationContracts/Volo/Abp/Application/Services/Dtos/EntityDto.cs
+++ b/src/Volo.Abp.ApplicationContracts/Volo/Abp/Application/Services/Dtos/EntityDto.cs
@@ -6,7 +6,7 @@ namespace Volo.Abp.Application.Services.Dtos
/// Implements common properties for entity based DTOs.
///
/// Type of the primary key
- public class EntityDto
+ public class EntityDto : IEntityDto
{
///
/// Id of the entity.
diff --git a/src/Volo.Abp.ApplicationContracts/Volo/Abp/Application/Services/Dtos/IEntityDto.cs b/src/Volo.Abp.ApplicationContracts/Volo/Abp/Application/Services/Dtos/IEntityDto.cs
new file mode 100644
index 0000000000..250c40c677
--- /dev/null
+++ b/src/Volo.Abp.ApplicationContracts/Volo/Abp/Application/Services/Dtos/IEntityDto.cs
@@ -0,0 +1,22 @@
+namespace Volo.Abp.Application.Services.Dtos
+{
+ /////
+ ///// A shortcut of for most used primary key type ().
+ /////
+ //public interface IEntityDto : IEntityDto
+ //{
+
+ //}
+
+ ///
+ /// Defines common properties for entity based DTOs.
+ ///
+ ///
+ public interface IEntityDto
+ {
+ ///
+ /// Id of the entity.
+ ///
+ TPrimaryKey Id { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/src/Volo.Abp.EntityFrameworkCore/Microsoft/Extensions/DependencyInjection/AbpEfCoreServiceCollectionExtensions.cs b/src/Volo.Abp.EntityFrameworkCore/Microsoft/Extensions/DependencyInjection/AbpEfCoreServiceCollectionExtensions.cs
index 1d55e5344c..b75694ccea 100644
--- a/src/Volo.Abp.EntityFrameworkCore/Microsoft/Extensions/DependencyInjection/AbpEfCoreServiceCollectionExtensions.cs
+++ b/src/Volo.Abp.EntityFrameworkCore/Microsoft/Extensions/DependencyInjection/AbpEfCoreServiceCollectionExtensions.cs
@@ -25,7 +25,7 @@ namespace Microsoft.Extensions.DependencyInjection
services.TryAddTransient();
services.TryAddSingleton(serviceProvider =>
{
- const string moduleName = "";
+ const string moduleName = ""; //TODO: Use AbpModuleDescriptor instead of module name?
var connInfoResolver = serviceProvider.GetRequiredService();
diff --git a/src/Volo.Abp/Volo/Abp/Domain/Entities/AggregateRoot.cs b/src/Volo.Abp/Volo/Abp/Domain/Entities/AggregateRoot.cs
index 02bcda67c4..24b9a5c6f5 100644
--- a/src/Volo.Abp/Volo/Abp/Domain/Entities/AggregateRoot.cs
+++ b/src/Volo.Abp/Volo/Abp/Domain/Entities/AggregateRoot.cs
@@ -2,5 +2,6 @@
{
public class AggregateRoot : Entity, IAggregateRoot
{
+
}
}
\ No newline at end of file
diff --git a/src/Volo.Abp/Volo/Abp/Domain/Entities/Entity.cs b/src/Volo.Abp/Volo/Abp/Domain/Entities/Entity.cs
index 0273ba57b5..c7c8f29458 100644
--- a/src/Volo.Abp/Volo/Abp/Domain/Entities/Entity.cs
+++ b/src/Volo.Abp/Volo/Abp/Domain/Entities/Entity.cs
@@ -79,19 +79,6 @@ namespace Volo.Abp.Domain.Entities
return false;
}
- //TODO: How to handle this?
- //if (this is IMayHaveTenant && other is IMayHaveTenant &&
- // this.As().TenantId != other.As().TenantId)
- //{
- // return false;
- //}
-
- //if (this is IMustHaveTenant && other is IMustHaveTenant &&
- // this.As().TenantId != other.As().TenantId)
- //{
- // return false;
- //}
-
return Id.Equals(other.Id);
}
diff --git a/src/Volo.Abp/Volo/Abp/Domain/Entities/EntityHelper.cs b/src/Volo.Abp/Volo/Abp/Domain/Entities/EntityHelper.cs
index b1140df9b3..68e1887029 100644
--- a/src/Volo.Abp/Volo/Abp/Domain/Entities/EntityHelper.cs
+++ b/src/Volo.Abp/Volo/Abp/Domain/Entities/EntityHelper.cs
@@ -1,5 +1,6 @@
using System;
using System.Reflection;
+using JetBrains.Annotations;
using Volo.Abp.Reflection;
namespace Volo.Abp.Domain.Entities
@@ -9,7 +10,7 @@ namespace Volo.Abp.Domain.Entities
///
public static class EntityHelper
{
- public static bool IsEntity(Type type)
+ public static bool IsEntity([NotNull] Type type)
{
return ReflectionHelper.IsAssignableToGenericType(type, typeof (IEntity<>));
}
@@ -22,7 +23,7 @@ namespace Volo.Abp.Domain.Entities
///
/// Gets primary key type of given entity type
///
- public static Type GetPrimaryKeyType(Type entityType)
+ public static Type GetPrimaryKeyType([NotNull] Type entityType)
{
foreach (var interfaceType in entityType.GetTypeInfo().GetInterfaces())
{
diff --git a/src/Volo.Abp/Volo/Abp/Domain/Entities/EntityNotFoundException.cs b/src/Volo.Abp/Volo/Abp/Domain/Entities/EntityNotFoundException.cs
index 762b86876c..51ca026ff0 100644
--- a/src/Volo.Abp/Volo/Abp/Domain/Entities/EntityNotFoundException.cs
+++ b/src/Volo.Abp/Volo/Abp/Domain/Entities/EntityNotFoundException.cs
@@ -5,7 +5,7 @@ namespace Volo.Abp.Domain.Entities
///
/// This exception is thrown if an entity excepted to be found but not found.
///
- //[Serializable]
+ //TODO: [Serializable]
public class EntityNotFoundException : AbpException
{
///
diff --git a/src/Volo.Abp/Volo/Abp/Domain/Repositories/IQueryableRepository.cs b/src/Volo.Abp/Volo/Abp/Domain/Repositories/IQueryableRepository.cs
index 80f713208e..d3450fd690 100644
--- a/src/Volo.Abp/Volo/Abp/Domain/Repositories/IQueryableRepository.cs
+++ b/src/Volo.Abp/Volo/Abp/Domain/Repositories/IQueryableRepository.cs
@@ -2,6 +2,7 @@
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
+using JetBrains.Annotations;
using Volo.Abp.Domain.Entities;
namespace Volo.Abp.Domain.Repositories
@@ -16,7 +17,7 @@ namespace Volo.Abp.Domain.Repositories
/// given predicate.
///
/// A condition to filter entities
- void Delete(Expression> predicate);
+ void Delete([NotNull] Expression> predicate);
///
/// Deletes many entities by function.
@@ -25,6 +26,6 @@ namespace Volo.Abp.Domain.Repositories
/// given predicate.
///
/// A condition to filter entities
- Task DeleteAsync(Expression> predicate);
+ Task DeleteAsync([NotNull] Expression> predicate);
}
}
\ No newline at end of file
diff --git a/src/Volo.Abp/Volo/Abp/Domain/Repositories/IRepository.cs b/src/Volo.Abp/Volo/Abp/Domain/Repositories/IRepository.cs
index d77fcdd931..d08fd83894 100644
--- a/src/Volo.Abp/Volo/Abp/Domain/Repositories/IRepository.cs
+++ b/src/Volo.Abp/Volo/Abp/Domain/Repositories/IRepository.cs
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Threading.Tasks;
+using JetBrains.Annotations;
using Volo.Abp.Domain.Entities;
using Volo.DependencyInjection;
@@ -17,12 +18,14 @@ namespace Volo.Abp.Domain.Repositories
/// Used to get all entities.
///
/// List of all entities
+ [NotNull]
List GetList();
///
/// Used to get all entities.
///
/// List of all entities
+ [NotNull]
Task> GetListAsync();
///
@@ -30,6 +33,7 @@ namespace Volo.Abp.Domain.Repositories
///
/// Primary key of the entity to get
/// Entity
+ [NotNull]
TEntity Get(TPrimaryKey id);
///
@@ -37,6 +41,7 @@ namespace Volo.Abp.Domain.Repositories
///
/// Primary key of the entity to get
/// Entity
+ [NotNull]
Task GetAsync(TPrimaryKey id);
///
@@ -44,6 +49,7 @@ namespace Volo.Abp.Domain.Repositories
///
/// Primary key of the entity to get
/// Entity or null
+ [CanBeNull]
TEntity Find(TPrimaryKey id);
///
@@ -51,19 +57,22 @@ namespace Volo.Abp.Domain.Repositories
///
/// Primary key of the entity to get
/// Entity or null
+ [CanBeNull]
Task FindAsync(TPrimaryKey id);
///
/// Inserts a new entity.
///
/// Inserted entity
- TEntity Insert(TEntity entity);
+ [NotNull]
+ TEntity Insert([NotNull] TEntity entity);
///
/// Inserts a new entity.
///
/// Inserted entity
- Task InsertAsync(TEntity entity);
+ [NotNull]
+ Task InsertAsync([NotNull] TEntity entity);
///
/// Inserts a new entity and gets it's Id.
@@ -72,7 +81,7 @@ namespace Volo.Abp.Domain.Repositories
///
/// Entity
/// Id of the entity
- TPrimaryKey InsertAndGetId(TEntity entity);
+ TPrimaryKey InsertAndGetId([NotNull] TEntity entity);
///
/// Inserts a new entity and gets it's Id.
@@ -81,31 +90,33 @@ namespace Volo.Abp.Domain.Repositories
///
/// Entity
/// Id of the entity
- Task InsertAndGetIdAsync(TEntity entity);
+ Task InsertAndGetIdAsync([NotNull] TEntity entity);
///
/// Updates an existing entity.
///
/// Entity
- TEntity Update(TEntity entity);
+ [NotNull]
+ TEntity Update([NotNull] TEntity entity);
///
/// Updates an existing entity.
///
/// Entity
- Task UpdateAsync(TEntity entity);
+ [NotNull]
+ Task UpdateAsync([NotNull] TEntity entity);
///
/// Deletes an entity.
///
/// Entity to be deleted
- void Delete(TEntity entity);
+ void Delete([NotNull] TEntity entity);
///
/// Deletes an entity.
///
/// Entity to be deleted
- Task DeleteAsync(TEntity entity);
+ Task DeleteAsync([NotNull] TEntity entity);
///
/// Deletes an entity by primary key.