Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/326.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 新表移动服务Azure,无法获取数据_C#_Azure_Azure Sql Database_Azure Mobile Services - Fatal编程技术网

C# 新表移动服务Azure,无法获取数据

C# 新表移动服务Azure,无法获取数据,c#,azure,azure-sql-database,azure-mobile-services,C#,Azure,Azure Sql Database,Azure Mobile Services,如何在azure mobile services中添加其他表,并以编程方式插入和读取数据。我尝试了与TodoItems表中的代码类似的方法。我的新表已经创建,我可以使用sql手动插入数据,但是当我使用 private MobileServiceCollection<User,User> users; private IMobileServiceTable<User> userTable = App.MobileService.GetTable<User>();

如何在azure mobile services中添加其他表,并以编程方式插入和读取数据。我尝试了与TodoItems表中的代码类似的方法。我的新表已经创建,我可以使用sql手动插入数据,但是当我使用

private MobileServiceCollection<User,User> users;
private IMobileServiceTable<User> userTable = App.MobileService.GetTable<User>();
我明白了

if (global::System.Diagnostics.Debugger.IsAttached) global::System.Diagnostics.Debugger.Break();

你知道我该怎么做吗?

如果你使用的是.NET后端,你需要执行以下操作:

创建表示表中项目的新实体。确定 使用正确的基类。 将新的TableController添加到控制器文件夹,并在向导中选择新的实体类和EF上下文类。 这将提供所需的API,并自动将DBset属性添加到ef上下文中。如果您是针对已部署版本而不是本地版本进行测试,请不要忘记将应用程序发布到Azure


如果你能提供更多关于当你点击那个断点时得到的异常的详细信息,这会有所帮助。检查Visual Studio中的“局部变量”窗口或检查当前方法的参数。

正如Matt所指出的,要将表添加到.NET后端,只需向代码优先数据模型添加一个新属性,该数据模型根据从该类型继承的新模型数据类型返回DbSet


请确保您也阅读了本主题,以了解当您尝试更改.NET后端移动服务的数据模型时会发生什么

这是使用Mobile Services Node.JS后端还是使用.NET后端?表是由服务创建的,还是在SQL中手动创建的?它是.NET后端,我是由服务创建的表,在VS中,我在DataObjects和myprojectContext.cs中创建了新类,包括以下内容:public DbSet Users{get;set;}链接不再有效这是什么向导?右键单击项目并添加->控制器并选择表格控制器模板时出现的向导或对话框。在实际创建控制器代码之前,它会询问这些细节。
if (global::System.Diagnostics.Debugger.IsAttached) global::System.Diagnostics.Debugger.Break();