【问题标题】:How to use existing data with azure?如何在 azure 中使用现有数据?
【发布时间】:2015-12-24 09:03:57
【问题描述】:

https://azure.microsoft.com/en-us/documentation/articles/mobile-services-dotnet-backend-use-existing-sql-database/

我一直在关注本教程,但它最终创建了一个清空所有数据的新表。如何让它使用现有表中的现有值?

【问题讨论】:

    标签: azure azure-mobile-services


    【解决方案1】:

    本教程确实使用Database.SetInitializer(new ExistingInitializer()); 填充示例数据,但它不会创建新数据库。 确保您有正确的连接字符串 Name=MS_TableConnectionString(探索现有数据库模型中的第 4 步),以便它指出您现有的数据库

    编辑:

    首先,注释掉数据库播种器Database.SetInitializer(new ExistingInitializer()); 并查询您现有的数据使用MobileCustomerController 中的GetAllMobileCustomersMobileOrderController 中的GetAllMobileOrders 它会给你IQueryableMobileCustomer 的@987654330 @object,随意使用那个对象

    【讨论】:

    • 那是个错误。我的意思是它会创建一个新的空表。
    • 如果它有效,不要忘记接受这个作为答案,这样它也会帮助有同样问题的人
    • 如果我要将表中的现有数据重新插入到自身中,以便自动生成教程中的四个字段,我将在哪里以及如何做?
    • 你的意思是什么字段?
    • CreatedAt,Deleted,Id,Updatedat,version
    猜你喜欢
    • 2015-10-14
    • 1970-01-01
    • 2020-09-29
    • 2013-06-23
    • 2021-08-16
    • 1970-01-01
    • 1970-01-01
    • 2019-11-07
    • 1970-01-01
    相关资源
    最近更新 更多