Subsonic 在亚音速分部类中添加新特性

Subsonic 在亚音速分部类中添加新特性,subsonic,Subsonic,我在sqlserver的表(活动)中添加了一个新列(DateCreated)。 我使用的是亚音速2.0,如何在亚音速分部类中添加此列作为属性,以便插入和更新“DateCreated”列的值。 DateCreated将由用户从GUI提供 下面是我正在使用的代码,但它从数据库中插入NULL和检索NULL public partial class ActivityInscription { public struct Columns { public static st

我在sqlserver的表(活动)中添加了一个新列(DateCreated)。 我使用的是亚音速2.0,如何在亚音速分部类中添加此列作为属性,以便插入和更新“DateCreated”列的值。 DateCreated将由用户从GUI提供

下面是我正在使用的代码,但它从数据库中插入NULL和检索NULL

public partial class ActivityInscription 
{

   public struct Columns
   {
        public static string IsInMixedList = @"IsInMixedList";
   }
   public bool? IsInMixedList
   {
       get;
       set;
   }

}

请任何人帮助我解决此问题。

如果您将列添加到数据库,则只需重建DAL即可。它将拾取新列并将其添加到亚音速DAL中。在您的情况下,没有理由使用部分类。如果表“活动”是配置文件中表的亚音速列表(includeTableList)的一部分,这将起作用。

以下是我使用的解决方案,它正在发挥作用:

公共部分班级活动 {

}


现在它工作正常&插入我从GUI提供的值。

是的,您是正确的。但是如果我们没有源代码呢。我在codegenerated文件夹中有DLL&class。
    public DateTime? DateCreated
    {
        get;
        set;
    }

    protected override void BeforeInsert()
    {
        TableSchema.Table tblSchema = Schema;

        TableSchema.TableColumn ccDateCreated = new TableSchema.TableColumn(tblSchema);

            ccrDateCreated.ColumnName = "DateCreated";
            ccDateCreated.DataType = DbType.DateTime;
            ccDateCreated.MaxLength = 0;
            ccDateCreated.AutoIncrement = false;
            ccDateCreated.IsNullable = false;
            ccDateCreated.IsPrimaryKey = false;
            ccDateCreated.IsForeignKey = false;
            ccDateCreated.IsReadOnly = false;
            ccDateCreated.DefaultSetting = @"";
            ccDateCreated.ForeignKeyTableName = "";

        if (!tblSchema.Columns.Contains("DateCreated"))
        {
            tblSchema.Columns.Add(ccDateCreated); 
        }

        if (this.GetSchema().Columns.Contains("DateCreated"))
            this.SetColumnValue(Columns.DateCreated, DateCreated);

        base.BeforeInsert();
    }