/// <summary> /// Resolve all <see cref="IMigrationExpression"/>'s from a <see cref="ExpressionBuilderBase<T>"/><br/> /// <br/> /// Exception <see cref="FieldAccessException"/> wil be thrown if <see cref="ExpressionBuilderBase<T>"/> is missing the <see cref="IMigrationContext"/> /// </summary> /// <param name="builder"></param> /// <typeparam name="T"></typeparam> /// <returns></returns> /// <exception cref="FieldAccessException"></exception> public static IList <IMigrationExpression> GetMigrationExpressions <T>( this ExpressionBuilderBase <T> builder) where T : class, IMigrationExpression { var context = builder.GetMigrationContextFromBuilder(); return(context?.Expressions as IList <IMigrationExpression> ?? throw new FieldAccessException($" Field of type 'IMigrationContext' not found in type[{builder.GetType().Name}]")); }
public IActionResult Index() { return(View(ExpressionBuilderBase.GetCompileCounts())); }
/// <summary> /// Using <see cref="Expression"/>'s to Search object <paramref name="builder"/> for <see cref="IMigrationContext"/> field /// </summary> /// <param name="builder"></param> /// <typeparam name="T"></typeparam> /// <returns><see cref="IMigrationContext"/></returns> public static IMigrationContext GetMigrationContextFromBuilder <T>(this ExpressionBuilderBase <T> builder) where T : class, IMigrationExpression { return(builder.GetMigrationContextFromObject()); }