using System;
using Quadarax.Foundation.Core.Exceptions;

namespace BO.AppServer.Business.Exceptions
{
    public class EntityAlreadyExistsException : CodeException
    {
        private const string CS_MESSAGE = "Entity '{0}' named '{1}' already exists in database.";
        private const int CN_CODE = 1000;

        public EntityAlreadyExistsException(Type entityType, string name, Exception innerException) : base(CN_CODE, string.Format(CS_MESSAGE, entityType.Name, name), innerException)
        {
        }

        public EntityAlreadyExistsException(Type entityType, string name) : base(CN_CODE, string.Format(CS_MESSAGE, entityType.Name, name))
        {
        }
    }
}
