Does not implement the IDatabaseIntializer interface

advertisements

When I using the interface of System.Data.Entity.IDatabaseIntializer, it always says that it doesn't implement the interface.

namespace ImageSharingWithAuth.DAL
{
    public class ImageSharingDB : DbContext
    {
        public DbSet<Image> Images { get; set; }
        public DbSet<User> Users { get; set; }
        public DbSet<Tag> Tags { get; set; }
        public ImageSharingDB() : base("DefaultConnection") { }
    }
}

namespace ImageSharingWithAuth.DAL
{
    public class ImageSharingDBInitializer : IDatabaseInitializer<ImageSharingDB>
    {
        public void IntializeDatabase(ImageSharingDB db)
        {
            if (db.Database.Exists())
            {
                db.Database.ExecuteSqlCommand("alter database ImageSharingWithAuth set single_user with rollback immediate");
                db.Database.Delete();
            }
            db.Database.Create();
            WebSecurity.InitializeDatabaseConnection(
                "DefaultConnection",
                "Users",
                "Id",
                "UserId",
                autoCreateTables: true);
            this.Seed(db);
        }
        protected void Seed(ImageSharingDB db)
        {......

The interface should be System.Data.Entity.IDatabaseIntializer<in TContext> where TContext: DbContext, and the ImageSharingDB do is the DbContext, so I think that the ImageSharingDBInitializer should implement the IDatabaseIntializer.

However, .Net throws an error:

error CS0535: 'ImageSharingWithAuth.DAL.ImageSharingDBInitializer'does not implement
interface member System.Data.Entity.IDatabaseInitializer.InitializeDatabase(ImageSharingWithAuth.DAL.ImageSharingDB)'


It should be In-i-tializeDatabase but you have In-tializeDatabase.