/// <summary> /// Configures the table that the entity type maps to when targeting a relational database. /// </summary> /// <param name="entityTypeBuilder"> The builder for the entity type being configured. </param> /// <param name="name"> The name of the table. </param> /// <param name="fromDataAnnotation"> Indicates whether the configuration was specified using a data annotation. </param> /// <returns> /// The same builder instance if the configuration was applied, /// <see langword="null" /> otherwise. /// </returns> public static IConventionEntityTypeBuilder ToFunction( [NotNull] this IConventionEntityTypeBuilder entityTypeBuilder, [CanBeNull] string name, bool fromDataAnnotation = false) { if (!entityTypeBuilder.CanSetFunction(name, fromDataAnnotation)) { return(null); } var entityType = entityTypeBuilder.Metadata; entityType.SetFunctionName(name, fromDataAnnotation); entityType.Model.Builder.HasDbFunction(name, typeof(IQueryable <>).MakeGenericType(entityType.ClrType), fromDataAnnotation); return(entityTypeBuilder); }