gpt4 book ai didi

subsonic - SimpleRepository 中的父对象和子对象

转载 作者:行者123 更新时间:2023-12-02 19:45:16 26 4
gpt4 key购买 nike

如果我希望能够在对象之间建立一对多的关系,那么在 Subsonic 的 SimpleReporitory 中它将如何工作?

我是否必须创建一个桥接对象,然后在运行时构建我的父对象,还是内置了此支持?

我正在寻找的是以下内容:

亚当的示例商店...

Public Class Shop    Private m_id As Integer    Private m_Name As String    Private m_Employees As List(Of Employee)    Public Property Id() As Integer        Get            Return m_id        End Get        Set(ByVal value As Integer)            m_id = value        End Set    End Property    Public Property Name() As String        Get            Return m_Name        End Get        Set(ByVal value As String)            m_Name = value        End Set    End Property    Public Property Employees() As List(Of Employee)        Get            Return m_Employees        End Get        Set(ByVal value As List(Of Employee))            m_Employees = value        End Set    End PropertyEnd ClassPublic Class Employee    Private m_id As Integer    Private m_Name As String    Public Property Id() As Integer        Get            Return m_id        End Get        Set(ByVal value As Integer)            m_id = value        End Set    End Property    Public Property Name() As String        Get            Return m_Name        End Get        Set(ByVal value As String)            m_Name = value        End Set    End PropertyEnd Class

主要内容:

        Dim repo As New SimpleRepository("SubSonicObjectTest", SimpleRepositoryOptions.RunMigrations)        Dim emplyee1 As New Employee        emplyee1.Name = "Martin"        Dim emplyee2 As New Employee        emplyee2.Name = "Adam"        Dim shop As New Shop        shop.Name = "Sub Sonic Store"        shop.Employees = New List(Of Employee)        shop.Employees.Add(emplyee1)        shop.Employees.Add(emplyee2)        repo.Add(Of Shop)(shop)

我认为这应该创建 3 个表:

商店
员工
ShopsToEmployees(或其他一些命名约定)

但我只得到一个 channel 表!

最佳答案

我当前正在更新 SimpleRepo 内容,以根据集合自动创建连接表。确定多/多与 1/多并不容易 - 但我有一些想法:)。

关于subsonic - SimpleRepository 中的父对象和子对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1378292/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com