IDbContext interface not found in nopcommerce version 4.60.2

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
1 year ago
i am crating plugin in nopcommerce 4.60.2 for this plugin i need DbContext  and IDbContext but
IDbContext interface is not implementing it showing error 'are u missing any assemby'
any one no how to do this... any alternative
1 year ago
Entity Framework is no longer used
If you want to create some tables then have a look at one of the current plugins for example Nop.Plugin.Shipping.FixedByWeightByTotal
1 year ago
Thaks for Reply Sir,  I already create tables in plugin , i want to connect with database and want  touse database  for this method ExecuteStoredProcedureList(),GenerateCreateScript(), Uninstall(), Install() and more ... pls refer me how implements these method
any alternative for IDbContext


public ProductViewTrackerRecordObjectContext(DbContextOptions<ProductViewTrackerRecordObjectContext> options) : base(options)
        {
        }
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.ApplyConfiguration(new ProductViewTrackerRecordMap());
            base.OnModelCreating(modelBuilder);
        }

        public new virtual DbSet<TEntity> Set<TEntity>() where TEntity : BaseEntity
        {
            return base.Set<TEntity>();
        }

        public virtual string GenerateCreateScript()
        {
            return Database.GenerateCreateScript();
        }

        public virtual IQueryable<TQuery> QueryFromSql<TQuery>(string sql) where TQuery : class
        {
            throw new NotImplementedException();
        }

        public virtual IQueryable<TEntity> EntityFromSql<TEntity>(string sql, params object[] parameters) where TEntity : BaseEntity
        {
            throw new NotImplementedException();
        }

        public virtual int ExecuteSqlCommand(RawSqlString sql, bool doNotEnsureTransaction = false, int? timeout = null, params object[] parameters)
        {
            using (var transaction = Database.BeginTransaction())
            {
                var result = Database.ExecuteSqlCommand(sql, parameters);
                transaction.Commit();
                return result;
            }
        }

        public void Install()
        {
               //create the table
               this.ExecuteSqlScript(GenerateCreateScript());
        }
        public void Uninstall()
        {
               //drop the table
               this.DropPluginTable(nameof(ProductViewTrackerRecord));
        }

        public IList<TEntity> ExecuteStoredProcedureList<TEntity>(string commandText, params object[] parameters) where TEntity : BaseEntity, new()
        {
            throw new NotImplementedException();
        }

        public IEnumerable<TElement> SqlQuery<TElement>(string sql, params object[] parameters)
        {
            throw new NotImplementedException();
        }
        public int ExecuteSqlCommand(string sql, bool doNotEnsureTransaction = false, int? timeout = null, params object[] parameters)
        {
            throw new NotImplementedException();
        }

        public virtual void Detach<TEntity>(TEntity entity) where TEntity : BaseEntity
        {
            throw new NotImplementedException();
        }

        public IQueryable<TQuery> QueryFromSql<TQuery>(string sql, params object[] parameters) where TQuery : class
        {
            throw new NotImplementedException();
        }

        public virtual bool ProxyCreationEnabled
        {
            get => ProxyCreationEnabled;
            set => ProxyCreationEnabled = value;
        }

        public virtual bool AutoDetectChangesEnabled
        {
            get => AutoDetectChangesEnabled;
            set => AutoDetectChangesEnabled = value;
        }
1 year ago
here is code how i created table
public class TrialTrackerRecord: BaseEntity
    {
        public int TrialTrackerId { get; set; }
        public string CustomerName { get; set; }
        public string CustomerEmail { get; set; }
        public string ProductName { get; set; }
        public int Productid { get; set; }
        public string DownloadDate { get; set; }
        public bool OnMailingList { get; set; }
    }[code]

public class TrailTrackerRecordMap : EntityTypeConfiguration<TrialTrackerRecord>
    {
        public TrailTrackerRecordMap()
        {
            ToTable("TrialTracker");
            HasKey(m => m.TrialTrackerId);
            Property(m => m.CustomerEmail);
            Property(m => m.CustomerName);
            Property(m => m.ProductName);
            Property(m => m.Productid);
            Property(m => m.DownloadDate);
            Property(m => m.OnMailingList);
        }
  
    }[/code]
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.