我有一个Country对象,其中包含一个区域列表作为其中一个属性。以下是对象:
DTApp = function(data, ..., options = list()) {
library(shiny)
library(DT)
shinyApp(
ui = fluidPage(
fluidRow(
verbatimTextOutput('foo'),
DT::dataTableOutput('tbl')
)
),
server = function(input, output, session) {
options$ajax = list(url = dataTableAjax(session, data))
# create a widget using an Ajax URL created above
widget = datatable(data, server = TRUE, ..., options = options)
output$tbl = DT::renderDataTable(widget)
output$foo = renderPrint(str(input$tbl_state))
}
)
}
DTApp(iris, options = list(stateSave = TRUE))
注意,我有:
[Table("COUNTRY")] public class Country : ICountry { [Column("COUNTRY_CD")] public int? Id { get; set; } [Column("COUNTRY_NAME")] public string Name { get; set; } public List<Territory> Territories { get; set; } List<ITerritory> ICountry.Territories { get { List<ITerritory> list = new List<ITerritory>(); foreach (var item in Territories) { list.Add(item); } return list; } set { Territories = new List<Territory>(); foreach (var item in value) { Territories.Add(item as Territory); } } } public class Territory : ITerritory { [Column("TERRITORY_CD")] public int? Id { get; set; } [Column("TERRITORY_NAME")] public string Name { get; set; } [Column("COUNTRY_CD")] public int? CountryCode { get; set; } }
因此我可以在其他接口中保留接口引用,但是具有实体框架的具体区域列表。
My Country Repository看起来像这样:
List<ITerritory> ICountry.Territories
我可以设置实体框架来填充区域列表吗?或者我是否需要一个被调用来填充该列表的辅助方法?