Linq to sql Windows Phone 7.5-本地SQL数据库

Linq to sql Windows Phone 7.5-本地SQL数据库,linq-to-sql,windows-phone-7,local-database,Linq To Sql,Windows Phone 7,Local Database,我正在创建WP7应用程序 在那个应用程序中,我使用LINQtoSQL创建本地数据库。我创建了这样一个类: [Table] public class User { [Column( IsPrimaryKey = true, IsDbGenerated = true, DbType = "INT NOT NULL Identity", CanBeNull = false)] public int Id { get; se

我正在创建WP7应用程序

在那个应用程序中,我使用LINQtoSQL创建本地数据库。我创建了这样一个类:

[Table]
public class User
{
    [Column(
        IsPrimaryKey = true,
        IsDbGenerated = true,
        DbType = "INT NOT NULL Identity",
        CanBeNull = false)]
    public int Id { get; set; }

    [Column]
    public string FirstName { get; set; }

    [Column]
    public string LastName { get; set; }     
}
我的数据上下文如下所示:

public class UserDataContext : DataContext
    {
        public static string connString = "Data Source=isostore:/Users.sdf";

        public UserDataContext(string connString)
            : base(connString)
        { }

        public Table<User> Users;
    }
但我的问题是:在保存用户列表时,会出现类似“保存1天”、“30天”或“永远”这样的无线框如果我选择“一天”,我必须将其保存一天,则本地数据库中的用户应在一天后删除;如果我选择“30天”,则应在30天后删除;如果我选择“永远”,则不应删除

我该怎么做


提前感谢。

我会在表中添加另一列(到期日)。 然后,我会用一个简单的查询清除数据

DELETE FROM User    
WHERE (expiryDate < GETDATE())
从用户中删除
其中(expiryDate

您也可以在Linq2Sql中执行此操作

您可以输入一个过期日期吗?那么他记录的每个查询检查都没有过期?定期清除过期记录?这是唯一的解决方案。但我希望运行作业(如sql server中的作业),以便在过期日期发生时自动删除。请告诉我如何删除独立存储中的表?
DELETE FROM User    
WHERE (expiryDate < GETDATE())