/// <summary>
        /// Resolve all <see cref="IMigrationExpression"/>'s from a <see cref="ExpressionBuilderBase&lt;T&gt;"/><br/>
        /// <br/>
        /// Exception <see cref="FieldAccessException"/> wil be thrown if <see cref="ExpressionBuilderBase&lt;T&gt;"/> 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}]"));
        }
Ejemplo n.º 2
0
 public IActionResult Index()
 {
     return(View(ExpressionBuilderBase.GetCompileCounts()));
 }
Ejemplo n.º 3
0
 /// <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());
 }