ich diese Nuget Bibliothek bin mit:Wie könnte man Automapper mit EntityFramework 6.1.3 verwenden, um benutzerdefinierte (UDF) DbFunciton-Aufrufe zu projizieren?
EntityFramework.CodeFirstStoreFunctions
Haben Sie diesen Code:
public abstract class DbCore : DbContext {
[DbFunction("CodeFirstDatabaseSchema", "DecodeBase64")]
public static string DbDecodeBase64(string encoded) {
throw new NotSupportedException();
}
protected override void OnModelCreating(DbModelBuilder modelBuilder) {
modelBuilder.Conventions.Add(new FunctionsConvention("dbo"));
base.OnModelCreating(modelBuilder);
}
}
Wenn ich diesen Code mit Projektionen laufen:
IMappingExpression mapperExpression = ...(omitted)
mapperExpression.ForMember(dest => dest.ContactNote, opt => opt.MapFrom(entity => DbCore.DbDecodeBase64(entity.ContactNote)));
Dann habe ich eine SQL-Funktion (UDF) genannt: DecodeBase64