列表中缺少Lightswitch数据源视图 [英] Lightswitch Datasource views missing from list
问题描述
我刚刚开始使用Lightswitch 2013,并且已经在SQL Server 2012数据库中创建了一个新视图,但是当我刷新数据源时无法在Lightswitch中看到它.我是否必须刷新某种缓存或其他内容?
I just started using Lightswitch 2013 and I have created a new view in my SQL Server 2012 database but cannot see it in Lightswitch when I go to refresh the datasource. Do I have to refresh some sort of cache or something?
ALTER VIEW viw_Months
AS
SELECT DISTINCT MonthKey, MonthName FROM dbo.dim_Time
Dim.Time表在DateID字段上具有一个主键.
The Dim.Time table has a primary key on the DateID field.
推荐答案
也许问题在于您的视图没有候选列作为主键:
Maybe the problem was your view doesn't have candidate column to be primary key :
LightSwitch必须能够为视图推断主键,以便可以将一行与另一行区别开.如果视图的所有列均可为空,则无法推断主键,并且LightSwitch不允许您选择要导入的主键.
LightSwitch must be able to infer a primary key for the view so that one row can be distringuished from another. If all of the view's columns are nullable then a primary key cannot be inferred and LightSwitch will not let you select it to be imported.
[相关的SO问题:我如何获得MS LightSwitch可以识别我的视图?
这篇关于列表中缺少Lightswitch数据源视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!