Remove obsoletes Umbraco.Infrastructure

This commit is contained in:
Benjamin Carleski
2020-01-20 11:26:01 -08:00
parent 0c1d54ba4d
commit 628373f7a4
4 changed files with 6 additions and 151 deletions

View File

@@ -5,7 +5,7 @@ using Umbraco.Core.Persistence.DatabaseModelDefinitions;
namespace Umbraco.Core.Migrations.Expressions.Delete.Index
{
public class DeleteIndexBuilder : ExpressionBuilderBase<DeleteIndexExpression>,
IDeleteIndexForTableBuilder, IDeleteIndexOnColumnBuilder
IDeleteIndexForTableBuilder, IExecutableBuilder
{
public DeleteIndexBuilder(DeleteIndexExpression expression)
: base(expression)
@@ -14,28 +14,10 @@ namespace Umbraco.Core.Migrations.Expressions.Delete.Index
/// <inheritdoc />
public void Do() => Expression.Execute();
public IndexColumnDefinition CurrentColumn { get; set; }
public IDeleteIndexOnColumnBuilder OnTable(string tableName)
public IExecutableBuilder OnTable(string tableName)
{
Expression.Index.TableName = tableName;
return this;
}
/// <inheritdoc />
public IExecutableBuilder OnColumn(string columnName)
{
var column = new IndexColumnDefinition { Name = columnName };
Expression.Index.Columns.Add(column);
return new ExecutableBuilder(Expression);
}
/// <inheritdoc />
public IExecutableBuilder OnColumns(params string[] columnNames)
{
foreach (string columnName in columnNames)
Expression.Index.Columns.Add(new IndexColumnDefinition { Name = columnName });
return new ExecutableBuilder(Expression);
}
}
}

View File

@@ -1,4 +1,6 @@
namespace Umbraco.Core.Migrations.Expressions.Delete.Index
using Umbraco.Core.Migrations.Expressions.Common;
namespace Umbraco.Core.Migrations.Expressions.Delete.Index
{
/// <summary>
/// Builds a Delete expression.
@@ -8,6 +10,6 @@
/// <summary>
/// Specifies the table of the index to delete.
/// </summary>
IDeleteIndexOnColumnBuilder OnTable(string tableName);
IExecutableBuilder OnTable(string tableName);
}
}

View File

@@ -1,23 +0,0 @@
using System;
using Umbraco.Core.Migrations.Expressions.Common;
namespace Umbraco.Core.Migrations.Expressions.Delete.Index
{
/// <summary>
/// Builds a Delete expression.
/// </summary>
public interface IDeleteIndexOnColumnBuilder : IFluentBuilder, IExecutableBuilder
{
/// <summary>
/// Specifies the column of the index.
/// </summary>
[Obsolete("I don't think this would ever be used when dropping an index, see DeleteIndexExpression.ToString")]
IExecutableBuilder OnColumn(string columnName);
/// <summary>
/// Specifies the column of the index.
/// </summary>
[Obsolete("I don't think this would ever be used when dropping an index, see DeleteIndexExpression.ToString")]
IExecutableBuilder OnColumns(params string[] columnNames);
}
}

View File

@@ -1,106 +0,0 @@
using System;
using System.Runtime.Serialization;
namespace Umbraco.Core.Persistence
{
/// <summary>
/// An exception used to indicate that an Umbraco entity could not be found.
/// </summary>
/// <seealso cref="System.Exception" />
[Obsolete("Instead of throwing an exception, return null or an HTTP 404 status code instead.")]
[Serializable]
public class EntityNotFoundException : Exception
{
/// <summary>
/// Gets the identifier.
/// </summary>
/// <value>
/// The identifier.
/// </value>
/// <remarks>
/// This object should be serializable to prevent a <see cref="SerializationException" /> to be thrown.
/// </remarks>
public object Id { get; private set; }
/// <summary>
/// Initializes a new instance of the <see cref="EntityNotFoundException" /> class.
/// </summary>
public EntityNotFoundException()
{ }
/// <summary>
/// Initializes a new instance of the <see cref="EntityNotFoundException" /> class.
/// </summary>
/// <param name="id">The identifier.</param>
/// <param name="message">The message.</param>
public EntityNotFoundException(object id, string message)
: base(message)
{
Id = id;
}
/// <summary>
/// Initializes a new instance of the <see cref="EntityNotFoundException" /> class.
/// </summary>
/// <param name="message">The message that describes the error.</param>
public EntityNotFoundException(string message)
: base(message)
{ }
/// <summary>
/// Initializes a new instance of the <see cref="EntityNotFoundException" /> class.
/// </summary>
/// <param name="message">The error message that explains the reason for the exception.</param>
/// <param name="innerException">The exception that is the cause of the current exception, or a null reference (<see langword="Nothing" /> in Visual Basic) if no inner exception is specified.</param>
public EntityNotFoundException(string message, Exception innerException)
: base(message, innerException)
{ }
/// <summary>
/// Initializes a new instance of the <see cref="EntityNotFoundException" /> class.
/// </summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination.</param>
protected EntityNotFoundException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
Id = info.GetValue(nameof(Id), typeof(object));
}
/// <summary>
/// When overridden in a derived class, sets the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> with information about the exception.
/// </summary>
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown.</param>
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination.</param>
/// <exception cref="ArgumentNullException">info</exception>
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info == null)
{
throw new ArgumentNullException(nameof(info));
}
info.AddValue(nameof(Id), Id);
base.GetObjectData(info, context);
}
/// <summary>
/// Returns a <see cref="System.String" /> that represents this instance.
/// </summary>
/// <returns>
/// A <see cref="System.String" /> that represents this instance.
/// </returns>
public override string ToString()
{
var result = base.ToString();
if (Id != null)
{
return "Umbraco entity (id: " + Id + ") not found. " + result;
}
return result;
}
}
}