Skip to content

Commit

Permalink
minor rename internal
Browse files Browse the repository at this point in the history
  • Loading branch information
iJungleboy committed Nov 22, 2021
1 parent 6184fdd commit 85396e3
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 24 deletions.
10 changes: 5 additions & 5 deletions ToSic.Eav.Core/Data/Decorators/IHasDecoratorExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ public static TDecorator GetDecorator<TDecorator>(this IEntity parent) where TDe
return parentWithDecorator.GetDecorator<TDecorator, IEntity>();
}

public static TDecorator GetDecorator<TDecorator>(this IContentType parent) where TDecorator : class, IDecorator
{
if (!(parent is IHasDecorators<IContentType> parentWithDecorator)) return null;
return parentWithDecorator.GetDecorator<TDecorator, IEntity>();
}
//public static TDecorator GetDecorator<TDecorator>(this IContentType parent) where TDecorator : class, IDecorator
//{
// if (!(parent is IHasDecorators<IContentType> parentWithDecorator)) return null;
// return parentWithDecorator.GetDecorator<TDecorator, IEntity>();
//}

}
}
2 changes: 1 addition & 1 deletion ToSic.Eav.Core/Data/Entities/EntityDecorator12.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace ToSic.Eav.Data
{
[PrivateApi("Still WIP")]
public class EntityDecorator12<T>: EntityDecorator where T: IDecorator<IEntity>
public class EntityDecorator12<T>: EntityWrapper where T: IDecorator<IEntity>
{
protected T Decorator;

Expand Down
6 changes: 3 additions & 3 deletions ToSic.Eav.Core/Data/Entities/EntityWrapper.Equality.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

namespace ToSic.Eav.Data
{
public partial class EntityDecorator: IEquatable<IEntityWrapper>
public partial class EntityWrapper: IEquatable<IEntityWrapper>
{
public IEntity EntityForEqualityCheck { get; }

public static bool operator ==(EntityDecorator d1, IEntityWrapper d2) => EntityWrapperEquality.IsEqual(d1, d2);
public static bool operator ==(EntityWrapper d1, IEntityWrapper d2) => EntityWrapperEquality.IsEqual(d1, d2);

public static bool operator !=(EntityDecorator d1, IEntityWrapper d2) => !EntityWrapperEquality.IsEqual(d1, d2);
public static bool operator !=(EntityWrapper d1, IEntityWrapper d2) => !EntityWrapperEquality.IsEqual(d1, d2);

public bool Equals(IEntityWrapper other) => EntityWrapperEquality.IsEqual(this, other);

Expand Down
2 changes: 1 addition & 1 deletion ToSic.Eav.Core/Data/Entities/EntityWrapper.Obsolete.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Old stuff for compatibility with DNN, should not bleed into Oqtane
namespace ToSic.Eav.Data
{
public partial class EntityDecorator
public partial class EntityWrapper
{

[PrivateApi]
Expand Down
25 changes: 13 additions & 12 deletions ToSic.Eav.Core/Data/Entities/EntityWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,15 @@ namespace ToSic.Eav.Data
/// Everything in the original is passed through invisibly. <br/>
/// </summary>
[PrivateApi("this decorator object is for internal use only, no value in publishing it")]
public abstract partial class EntityDecorator : IEntity, IEntityWrapper
public abstract partial class EntityWrapper : IEntity, IEntityWrapper
{
public IEntity Entity { get; }

/// <summary>
/// Initialize the object and store the underlying IEntity.
/// </summary>
/// <param name="baseEntity"></param>
/// <param name="decorator"></param>
protected EntityDecorator(IEntity baseEntity, IDecorator<IEntity> decorator) : this(baseEntity)
{
if(decorator != null) Decorators.Add(decorator);
}

/// <summary>
/// Initialize the object and store the underlying IEntity.
/// </summary>
/// <param name="baseEntity"></param>
protected EntityDecorator(IEntity baseEntity)
protected EntityWrapper(IEntity baseEntity)
{
Entity = baseEntity;
EntityForEqualityCheck = Entity;
Expand All @@ -42,6 +32,17 @@ protected EntityDecorator(IEntity baseEntity)
}
}

/// <summary>
/// Initialize the object and store the underlying IEntity. - adding an additional decorator
/// </summary>
/// <param name="baseEntity"></param>
/// <param name="decorator">Additional wrapper to add</param>
protected EntityWrapper(IEntity baseEntity, IDecorator<IEntity> decorator) : this(baseEntity)
{
if(decorator != null) Decorators.Add(decorator);
}


#region IEntity Implementation

/// <inheritdoc />
Expand Down
2 changes: 1 addition & 1 deletion ToSic.Eav.Core/Data/EntityBasedTypes/IEntityWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace ToSic.Eav.Data
/// A interface to ensure all things that carry an IEntity can be compared based on the Entity they carry.
/// </summary>
[PublicApi]
public interface IEntityWrapper: IHasDecorator<IEntity>
public interface IEntityWrapper: IHasDecorators<IEntity>
{
/// <summary>
/// The underlying entity.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace ToSic.Eav.Data
/// This is a special IEntity-wrapper which will return Stack-Navigation
/// </summary>
[PrivateApi]
public class EntityWithStackNavigation: EntityDecorator
public class EntityWithStackNavigation: EntityWrapper
{
public EntityWithStackNavigation(IEntity baseEntity, IPropertyStackLookup parent, string field, int index) : base(baseEntity)
{
Expand Down

0 comments on commit 85396e3

Please sign in to comment.