Saturday, January 18, 2014

Debugging Dll


System.Diagnostics.Debugger.Break();
Read More

Error for enumerable when using JsonConvert.SerializeObject


[Serializable]
    public abstract class Entity
    {
        public Entity()
        {
        }

        public Entity(int id)
        {
            this.Id = id;
        }

        public virtual int Id { get; set; }

        public override bool Equals(object obj)
        {
            Entity other = (Entity)obj;
            return this.Id == other.Id;
        }

        public override int GetHashCode()
        {
            return this.Id.GetHashCode();
        }
    }
Read More

Observer Design Pattern in Jquery


We can use observer design pattern (publisher - subscriber model) in jquery by triggering and attaching events.
Attach a trigger event for publisher
$('div').on('click', function(e) {
    $(this).trigger('MyEvent',e,parameterValue);
});


Attach subscriber methods
$(document).on('MyEvent', function(e,parameterValue) {
    //Do your stuffs with parameterValues..
});
Read More

Monday, January 13, 2014

Overwrite Appsetting in ASP.NET MVC

  var config = WebConfigurationManager.OpenWebConfiguration("~");
  config.AppSettings.Settings["appSettingKey"].Value ="Updated value";
  config.Save(ConfigurationSaveMode.Minimal, false);
  ConfigurationManager.RefreshSection("appSettings");

Read More
Powered By Blogger · Designed By Seo Blogger Templates