ASP.NET Dynamic Data Entities Web Application

Mar 12, 2014 at 12:19 PM
Hi, is possible use SecureEntity in Dynamic Data project? Code below doesn't work (it means on page is visible crypted data) but the variable 'name' contains decrypted value.

var ctx = new Context();
        SecurEntityLib.DbContextHelper dch =
              new SecurEntityLib.DbContextHelper(ctx);

        var proj = ctx.Projects.First();
        var name = proj.Name;


        DefaultModel.RegisterContext(
new Microsoft.AspNet.DynamicData.ModelProviders.EFDataModelProvider(() => ctx),
new ContextConfiguration { ScaffoldAllTables = true });
Coordinator
Mar 13, 2014 at 3:53 PM
The trick is getting the SecurEntity callbacks to fire. There's one for on-write (to encrypt) and one for on-read (decrypt). Further, the current implementation can only work when the whole object (row) is in memory, because all columns are included in the secure hash.