// This overload is provided because when TFunctions is static class, AddFunctions<TFunctions> cannot be compiled.
        public static void AddFunctions(
            this DbModelBuilder modelBuilder, Type functionsType, bool addComplexTypesFromAssembly = true)
        {
            if (modelBuilder == null)
            {
                throw new ArgumentNullException(nameof(modelBuilder));
            }

            if (functionsType == null)
            {
                throw new ArgumentNullException(nameof(functionsType));
            }

            if (addComplexTypesFromAssembly)
            {
                modelBuilder.AddComplexTypesFromAssembly(functionsType.Assembly);
            }

            modelBuilder.Conventions.Add(new FunctionConvention(functionsType));
        }