Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Where should we add code to open the key?
Message
 
 
À
Tous
Information générale
Forum:
C#
Catégorie:
Entity Framework
Titre:
Where should we add code to open the key?
Divers
Thread ID:
01652133
Message ID:
01652133
Vues:
43
Hi everybody,

We're using EF for our project. Recently we added security which requires opening the symmetric key. I'm wondering how can we plug it into EF?

I see we're using this code
   public abstract class DbContextBase : DbContext, IContext, IDisposable
    {
        protected DbContextBase(string connection)
            : base(connection)
        {
            SetConfigurationProperties();            
        }

        protected DbContextBase(string connection, DbCompiledModel model) : base(connection, model)
        {
            SetConfigurationProperties();
        }

        protected DbContextBase(System.Data.Common.DbConnection existingConnection, bool contextOwnsConnection)
            : base(existingConnection, contextOwnsConnection)
        {
            SetConfigurationProperties();
        }

        protected DbContextBase(System.Data.Common.DbConnection existingConnection, System.Data.Entity.Infrastructure.DbCompiledModel model, bool contextOwnsConnection)
            : base(existingConnection, model, contextOwnsConnection)
        {
            SetConfigurationProperties();
        }

        public void SetDbConnectionString(String name)
        {
            base.Database.Connection.ConnectionString = name;
        }

        private void SetConfigurationProperties()
        {
            this.Configuration.ProxyCreationEnabled = false;
            this.Configuration.LazyLoadingEnabled = false;
        }
     // etc.
but I don't see where should we plug opening of the key into this code (and if it should be done here or not). Can you please provide a sample or provide me with a reference to a blog of how this should be done in EF?

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Répondre
Fil
Voir

Click here to load this message in the networking platform