更改视觉基本模型文件后,Visual Studio更新SQL表模式

发布于 2025-02-13 22:29:36 字数 497 浏览 0 评论 0原文

假设我有一个文件订单

Imports System.Data.Entity
Imports DbContext

Public Class Order
    Public Property id As Guid
    Public Property storeNumber As Integer
End Class
Public Class OrderDBContext
    Inherits DbContext
    Public Property Orders() As DbSet(Of Order)
End Class

然后,我将其更改为:

...
    Public Property storeNumber As Integer?
...

制作StoreNumber字段nullable。

如何告诉Visual Studio根据新模型更新更新SQL Server表?

Let's say I have a file Orders.vb, with this content:

Imports System.Data.Entity
Imports DbContext

Public Class Order
    Public Property id As Guid
    Public Property storeNumber As Integer
End Class
Public Class OrderDBContext
    Inherits DbContext
    Public Property Orders() As DbSet(Of Order)
End Class

The table was automatically created in SQL Server.

Then I change it to this:

...
    Public Property storeNumber As Integer?
...

making the storeNumber field nullable.

How do I tell Visual Studio to update the SQL Server table based on the new model update?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文