: 기본적으로어떻게하는 A 설정하는 SQLite는-인터넷 Extensions를 사용> C 관계를
public class StockGrouping
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
public string Description { get; set; }
[OneToMany(CascadeOperations = CascadeOperation.All)] // One to many relationship with Valuation
public List<Stock> Stocks { get; set; }
}
public class Stock : IList<Valuation>
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
[MaxLength(8)]
public string Symbol { get; set; }
[ForeignKey(typeof(StockGrouping))]
public int StockGroupingId { get; set; }
[OneToMany(CascadeOperations = CascadeOperation.All)] // One to many relationship with Valuation
public List<Valuation> Valuations { get; set; }
#region IList implementation
#endregion
}
public class Valuation
{
[PrimaryKey, AutoIncrement]
public int Id { get; set; }
[ForeignKey(typeof(Stock))] // Specify the foreign key
public int StockId { get; set; }
public DateTime Time { get; set; }
public decimal Price { get; set; }
[ManyToOne] // Many to one relationship with Stock
public Stock Stock { get; set; }
}
나는 전체가를 구조가 어디 주식 밸류있다 주식을 가지고 그룹.
iOS 그룹화 된 테이블보기를 사용하여 특정 카테고리에 그룹화 된 주식을 갖게하는 아이디어로이를 설정하고 있습니다.
SQLite-Net Extensions를 사용하면 이러한 종류의 설정이 가능합니까? 내가 지금처럼 내 SQLite는 테이블을 만들 때이 시점에서
나는 예외를 받고 있어요 : 그것은 StockGrouping을 이해하지 못하는 말하는 sqLiteConnection.CreateTable() 라인에 실패private void CreateDataBase()
{
sqLiteConnection.CreateTable<Stock>();
sqLiteConnection.CreateTable<StockGrouping>();
sqLiteConnection.CreateTable<Valuation>();
}
.
아이디어가 있으십니까? 이것도 가능합니까?
? 어느 선 에서요? SQLite-Net Extensions MvvmCross 패키지 (https://www.nuget.org/packages/SQLiteNetExtensions-MvvmCross/)를 사용하고 있습니까? – redent84
'Stock' 클래스가'IList'을 상속하는 이유는 무엇입니까? –
redent84
그건 내 코드가 아니지만 우리 웹 사이트에서 예제를 재 작업하여 우리 모두가 같은 페이지에 있도록하려했습니다. 기본적으로 나는 평가 목록을 보유하고있는 카테고리의리스트를 보유하고있는 부모 클래스를 가지고있다. 상위 클래스를 클릭하면 그룹 설명이 헤더 행으로 표시되고 하위 평가는 하위 행으로 표시되는 그룹화 된 iOS 테이블보기를 수행하려고합니다. 테이블에 대한 내 MvxTableViewSource를 만들려면 ItemsSource에 대한 List 양식의 데이터가 필요했습니다. 나는 IEnumerable이 나를 충분히 얻을 것 같아요! – PkL728