LINQ InsertOnSubmit: NullReferenceException

前端 未结 6 2015
野的像风
野的像风 2020-12-06 16:22

I have this code:

using DC = MV6DataContext;
using MV6; // Business Logic Layer
// ...

public DC.MV6DataContext dc = new DC.MV6DataContext(ConnectionString)         


        
6条回答
  •  情书的邮戳
    2020-12-06 17:19

    Since the default constructor already initializes base(), this._Sessions and runs the OnCreated method, all you need to do in your extended constructor is this:

    public IP(string address) : this()
    {
        Address = address;
        Domain = "";
        Notes = "";
        FirstAccess = DateTime.Now;
        LastAccess = DateTime.Now;
    }
    

提交回复
热议问题