Skip to content

Commit

Permalink
File Renames / minor
Browse files Browse the repository at this point in the history
  • Loading branch information
iJungleboy committed Nov 22, 2021
1 parent d8afe3c commit 6184fdd
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 11 deletions.
8 changes: 5 additions & 3 deletions ToSic.Eav.Core/Data/ContentTypes/ContentType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,20 @@ public class ContentType : IContentType, IContentTypeShared
public ContentType(int appId, string name, string staticName, int attributeSetId, string scope,
string description, int? usesConfigurationOfAttributeSet,
int configZoneId, int configAppId,
bool configurationIsOmnipresent,
//IHasMetadataSource metaProviderOfThisApp = null,
bool configurationIsOmnipresent,
Func<IHasMetadataSource> metaSourceFinder = null): this(appId, name, staticName)
{
ContentTypeId = attributeSetId;
Description = description;
Scope = scope;

// Shared Content-Types
ParentId = usesConfigurationOfAttributeSet;
ParentZoneId = configZoneId;
ParentAppId = configAppId;
AlwaysShareConfiguration = configurationIsOmnipresent;
//_metaOfThisApp = metaProviderOfThisApp;

// Metadata
_metaSourceFinder = metaSourceFinder;
}

Expand Down
13 changes: 8 additions & 5 deletions ToSic.Eav.Core/Data/Decorators/IHasDecoratorExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,21 @@ namespace ToSic.Eav.Data
// ReSharper disable once InconsistentNaming
public static class IHasDecoratorExtensions
{
public static TDecorator GetDecorator<TDecorator, T>(this IHasDecorator<T> parent) where TDecorator: class, IDecorator
public static TDecorator GetDecorator<TDecorator, T>(this IHasDecorators<T> parent) where TDecorator: class, IDecorator
{
var decorator = parent?.Decorators?.FirstOrDefault(d => d is TDecorator);
return decorator as TDecorator;
}

//public static TDecorator GetDecorator<TDecorator>(this IHasDecorator<IEntity> parent) where TDecorator: class, IDecorator
// => parent.GetDecorator<TDecorator, IEntity>();

public static TDecorator GetDecorator<TDecorator>(this IEntity parent) where TDecorator : class, IDecorator
{
if (!(parent is IHasDecorator<IEntity> parentWithDecorator)) return null;
if (!(parent is IHasDecorators<IEntity> 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>();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace ToSic.Eav.Data
/// </summary>
/// <typeparam name="T"></typeparam>
[InternalApi_DoNotUse_MayChangeWithoutNotice("Marks objects which have decorator information")]
public interface IHasDecorator<T>
public interface IHasDecorators<T>
{
List<IDecorator<T>> Decorators { get; }
}
Expand Down
3 changes: 1 addition & 2 deletions ToSic.Eav.Persistence.Efc/Efc11Loader_ContentTypes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ private ImmutableList<IContentType> LoadContentTypesIntoLocalCache(int appId,
var notGhost = set.IsGhost == null;
return (IContentType)new ContentType(appId, set.Name, set.StaticName, set.AttributeSetId,
set.Scope, set.Description, set.IsGhost, set.ZoneId, set.AppId, set.ConfigIsOmnipresent, // source,
//_appStates,
set.Scope, set.Description, set.IsGhost, set.ZoneId, set.AppId, set.ConfigIsOmnipresent,
() => notGhost ? source : _appStates.Get(new AppIdentity(set.ZoneId, set.AppId))
)
{
Expand Down

0 comments on commit 6184fdd

Please sign in to comment.