title: How To add another constructor with parameter in linq class(Table)
body: <p>I am using LINQ to SQL in an ASP.NET project. While inserting the table I need to convert the values to the particular table object and I need to insert.</p>
  
  <p>For that I created a new constructor in that table with parameter so that I can assign my value to that table object , the assign the functionality is working but while inserting  (<code>obj.TS_Questions.InsertOnSubmit(mytableobject);</code>) I get null exception.</p>
  
  <p>my code::</p>
  
  <pre><code>default constructor for my table
  
  public TS_Question()
          {
              this._TS_Options = new EntitySet&lt;TS_Option&gt;(new Action&lt;TS_Option&gt;(this.attach_TS_Options), new Action&lt;TS_Option&gt;(this.detach_TS_Options));
              this._TS_QuestGroups = new EntitySet&lt;TS_QuestGroup&gt;(new Action&lt;TS_QuestGroup&gt;(this.attach_TS_QuestGroups), new Action&lt;TS_QuestGroup&gt;(this.detach_TS_QuestGroups));
              this._TS_QuestRecords = new EntitySet&lt;TS_QuestRecord&gt;(new Action&lt;TS_QuestRecord&gt;(this.attach_TS_QuestRecords), new Action&lt;TS_QuestRecord&gt;(this.detach_TS_QuestRecords));
              this._TS_Admin = default(EntityRef&lt;TS_Admin&gt;);
              this._TS_LevelType = default(EntityRef&lt;TS_LevelType&gt;);
              this._TS_OptionTypeLT = default(EntityRef&lt;TS_OptionTypeLT&gt;);
              OnCreated();
          }
  </code></pre>
  
  <hr>
  
  <p>constructor created by me</p>
  
  <pre><code>    public TS_Question(Guid Quest_QuestIDBL, string Quest_NameBL, Nullable&lt;Guid&gt; Quest_OptionTypeIDBL, Guid Quest_AdminIDBL, Guid Ques_LevelIDBL, int Quest_TimeBL, int Quest_MarkBL, string Qest_ExplanationBL, Nullable&lt;bool&gt; Qest_IsMultipleAnswerBL)
      {
  
          this._TS_Options = new EntitySet&lt;TS_Option&gt;(new Action&lt;TS_Option&gt;(this.attach_TS_Options), new Action&lt;TS_Option&gt;(this.detach_TS_Options));
          this._TS_QuestGroups = new EntitySet&lt;TS_QuestGroup&gt;(new Action&lt;TS_QuestGroup&gt;(this.attach_TS_QuestGroups), new Action&lt;TS_QuestGroup&gt;(this.detach_TS_QuestGroups));
          this._TS_QuestRecords = new EntitySet&lt;TS_QuestRecord&gt;(new Action&lt;TS_QuestRecord&gt;(this.attach_TS_QuestRecords), new Action&lt;TS_QuestRecord&gt;(this.detach_TS_QuestRecords));
          this._TS_Admin = default(EntityRef&lt;TS_Admin&gt;);
          this._TS_LevelType = default(EntityRef&lt;TS_LevelType&gt;);
          this._TS_OptionTypeLT = default(EntityRef&lt;TS_OptionTypeLT&gt;);
          OnCreated();
  
          this._Quest_QuestID = Quest_QuestIDBL;
          this._Quest_Name = Quest_NameBL; 
          if (Quest_OptionTypeIDBL != null)
          {
              this._Quest_OptionTypeID = Quest_OptionTypeIDBL;
          }
          this._Quest_AdminID = Quest_AdminIDBL;
          this._Ques_LevelID = Ques_LevelIDBL;
          this._Quest_Time = Quest_TimeBL;
          this._Quest_Mark = Quest_MarkBL;
          this._Qest_Explanation = Qest_ExplanationBL;
          this._Qest_IsMultipleAnswer = Qest_IsMultipleAnswerBL;
  
      }
  </code></pre>
  
  <p>Please help me out from this problem</p>