コード例 #1
0
        public static ObjectExtensionPropertyInfo GetPropertyOrNull(
            [NotNull] this ObjectExtensionManager objectExtensionManager,
            [NotNull] Type objectType,
            [NotNull] string propertyName)
        {
            Check.NotNull(objectExtensionManager, nameof(objectExtensionManager));
            Check.NotNull(objectType, nameof(objectType));
            Check.NotNull(propertyName, nameof(propertyName));

            return(objectExtensionManager
                   .GetOrNull(objectType)?
                   .GetPropertyOrNull(propertyName));
        }
コード例 #2
0
 public static ObjectExtensionManager MapEfCoreProperty <TEntity, TProperty>(
     [NotNull] this ObjectExtensionManager objectExtensionManager,
     [NotNull] string propertyName,
     [CanBeNull] Action <PropertyBuilder> propertyBuildAction = null)
     where TEntity : IHasExtraProperties, IEntity
 {
     return(objectExtensionManager.MapEfCoreProperty(
                typeof(TEntity),
                typeof(TProperty),
                propertyName,
                propertyBuildAction
                ));
 }
コード例 #3
0
 public static ObjectExtensionManager AddOrUpdateProperty <TObject, TProperty>(
     [NotNull] this ObjectExtensionManager objectExtensionManager,
     [NotNull] string propertyName,
     [CanBeNull] Action <ObjectExtensionPropertyInfo> configureAction = null)
     where TObject : IHasExtraProperties
 {
     return(objectExtensionManager.AddOrUpdateProperty(
                typeof(TObject),
                typeof(TProperty),
                propertyName,
                configureAction
                ));
 }
コード例 #4
0
        public static ImmutableList <ObjectExtensionPropertyInfo> GetProperties(
            [NotNull] this ObjectExtensionManager objectExtensionManager,
            [NotNull] Type objectType)
        {
            Check.NotNull(objectExtensionManager, nameof(objectExtensionManager));
            Check.NotNull(objectType, nameof(objectType));

            var extensionInfo = objectExtensionManager.GetOrNull(objectType);

            if (extensionInfo == null)
            {
                return(EmptyPropertyList);
            }

            return(extensionInfo.GetProperties());
        }
コード例 #5
0
        public static ObjectExtensionManager AddOrUpdateProperty(
            [NotNull] this ObjectExtensionManager objectExtensionManager,
            [NotNull] Type objectType,
            [NotNull] Type propertyType,
            [NotNull] string propertyName,
            [CanBeNull] Action <ObjectExtensionPropertyInfo> configureAction = null)
        {
            Check.NotNull(objectExtensionManager, nameof(objectExtensionManager));

            return(objectExtensionManager.AddOrUpdate(
                       objectType,
                       options =>
            {
                options.AddOrUpdateProperty(
                    propertyType,
                    propertyName,
                    configureAction
                    );
            }));
        }
コード例 #6
0
        public static ObjectExtensionManager MapEfCoreProperty(
            [NotNull] this ObjectExtensionManager objectExtensionManager,
            [NotNull] Type entityType,
            [NotNull] Type propertyType,
            [NotNull] string propertyName,
            [CanBeNull] Action <PropertyBuilder> propertyBuildAction = null)
        {
            Check.NotNull(objectExtensionManager, nameof(objectExtensionManager));

            return(objectExtensionManager.AddOrUpdateProperty(
                       entityType,
                       propertyType,
                       propertyName,
                       options =>
            {
                options.MapEfCore(
                    propertyBuildAction
                    );
            }
                       ));
        }
コード例 #7
0
        public static ObjectExtensionManager AddOrUpdateProperty(
            [NotNull] this ObjectExtensionManager objectExtensionManager,
            [NotNull] Type[] objectTypes,
            [NotNull] Type propertyType,
            [NotNull] string propertyName,
            [CanBeNull] Action <ObjectExtensionPropertyInfo> configureAction = null)
        {
            Check.NotNull(objectTypes, nameof(objectTypes));

            foreach (var objectType in objectTypes)
            {
                objectExtensionManager.AddOrUpdateProperty(
                    objectType,
                    propertyType,
                    propertyName,
                    configureAction
                    );
            }

            return(objectExtensionManager);
        }
コード例 #8
0
 public static ImmutableList <ObjectExtensionPropertyInfo> GetProperties <TObject>(
     [NotNull] this ObjectExtensionManager objectExtensionManager)
 {
     return(objectExtensionManager.GetProperties(typeof(TObject)));
 }