Translate

Monday 25 June 2018

how to enable lazy loading entire project using entitty framework in .net framework I use in Context class


I set it in the constructor of  Context class  i.e. this.Configuration.LazyLoadingEnabled = false;

Below is the code snippet.

 public partial class PabitraEntities : DbContext
    {
        public PabitraEntities()
            : base("name=PabitraEntities")
        {         
            this.Configuration.LazyLoadingEnabled = false;
        }

      protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            throw new UnintentionalCodeFirstException();
        }

  public virtual DbSet<CountryMaster> CountryMasters { get; set; }
}

Tuesday 19 June 2018

html control in array for looping

foreach (HtmlControl htm in new HtmlControl[] { trCRCCName, trCRCCIdentification, trCRCCMobile }) htm.Visible = false;