Ignoring Default Value Properties While Storing Whole Object In Hangfire.Job Table

sql-server
Tags: #<Tag:0x00007f4998b86350>

#1

I am facing property missing issue while creating a job

Just check below example ( in C# )

public class DemoClass {
public decimal DefaultValue1 { get; set; }
public decimal DefaultValue2 { get; set; }
public decimal DefaultValue3 { get; set; }
public decimal? DefaultValueNullable4 { get; set; }
}

var model = new DemoClass {
DefaultValue2 = 0.00, // Default value of decimal datatype
DefaultValue3 = 1.00, // Assigned some value
DefaultValueNullable4 = null // Assigned null to nullable property
};

BackgroundJobClient.Enqueue(() => Store(model));

After this, Hangfire is storing one record in Hangfire.Job table,
But in that record it is storing only one property which is assigned with value, it is ignoring properties which is assigned with null or its default value

It is storing value in Arguments column like this
["{“DefaultValue3”:1.00}"]

but instead of that, i want hangfire to save my whole object with all values

Here is my configuration of hangfire in global.asax.cs file

GlobalConfiguration.Configuration
.UseSqlServerStorage(“DatabaseName”)
.UseLog4NetLogProvider()
.UseRecommendedSerializerSettings();

Please solve my problem,
Thanks


#2

Ok Thanks, Got The Answer By Myself