我有一個出色的服務的Silverlight:925拋出異常
public sealed class SterlingService : IApplicationService, IApplicationLifetimeAware, IDisposable
{
private SterlingEngine _engine;
private static readonly ISterlingDriver _driver = new IsolatedStorageDriver();
public static SterlingService Current { get; private set; }
public ISterlingDatabaseInstance Database { get; private set; }
public static void StartUpDatabase()
{
Current.Database = Current._engine.SterlingDatabase.RegisterDatabase<LocalDB>(_driver);
}
....
....
}
而且我的LocalDB類在那裏我有表的定義是:
public class LocalDB : BaseDatabaseInstance
{
protected override List<ITableDefinition> RegisterTables()
{
return new List<ITableDefinition>()
{
CreateTableDefinition<ContactData, Guid>(k => k.UID.Value)
.WithIndex<ContactData, int, Guid>("CustomerId", t => t.CustomerId.Value),
CreateTableDefinition<ContactDetailData, Guid>(k => k.ContactData.UID.Value)
.WithIndex<ContactDetailData, int, Guid>("CustomerId", t => t.ContactData.CustomerId.Value),
....
};
}
}
現在的問題是,當我從存儲中的數據。 保存工作正常,但當我獲取我得到「無效的轉換操作異常從字符串Guid」。
public static List<ContactData> GetContactListFromLocalDB(int customerId)
{
var data = (from k in SterlingService.Current.Database.Query<ContactData, int, Guid>("CustomerId")
where k.LazyValue != null && k.Index == customerId
select k.LazyValue.Value);
return data.ToList<ContactData>(); (**HERE I GET THE EXCEPTION**)
}
請讓我知道我在做錯什麼。
謝謝。