Search code examples
c#entity-framework.net-coreodp.netflashback

How do I add Oracle Flashback columns to a .Net Core Entity Framework EDMX on affected entities?


During development of a .Net Core EF app, the DBAs implemented Oracle Flashback, which is queried by addressing the table being audited instead of a manual join to another table. How do I add these columns to the EDMX files so that the app may query them and present results? Simply refreshing the EDMX doesn't bring in the Flashback information.


Solution

  • You'll need to run Raw SQL Queries. Eg

    using (var context = new BloggingContext())
    { 
        var sql = "SELECT * FROM dbo.Blogs AS OF TIMESTAMP TO_TIMESTAMP('2021-03-29 13:34:12', 'YYYY-MM-DD HH24:MI:SS')";
        var blogs = context.Blogs.SqlQuery(sql).ToList();
    }