Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Where should we add code to open the key?
Message
 
 
To
All
General information
Forum:
C#
Category:
Entity Framework
Title:
Where should we add code to open the key?
Miscellaneous
Thread ID:
01652133
Message ID:
01652133
Views:
42
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
Reply
Map
View

Click here to load this message in the networking platform