Visual Studio 数据生成和多对多
Visual Studio 附带的数据生成工具允许您使用随机/模式数据填充表。例如,您可以告诉它用 50,000 行填充员工表,并且可以告诉它为每个员工行向地址表添加 5 个地址行。
我有一个连接表,与这篇维基百科文章中引用的权限示例非常相似。下面的伪代码...
create table Users (
UserId int primary key,
Username varchar(50)
)
create table Permissions (
PermissionId int primary key,
Description varchar(50)
)
create table UserPermission (
UserPermissionId int primary key,
UserId int, -- foreign key to Users
PermissionId int -- foreign key to Permissions
)
是否可以使用 Visual Studio 的数据生成工具来填充用户、权限和关联的联结表?
使用 GUI,我只能填充两个相关的其中之一通过从连接表的相关表下拉列表中选择它来创建表。
The data generation tool that comes with Visual Studio allows you to populate tables with random/patterned data. As an example, you can tell it to populate an Employees table with 50,000 rows and you can tell it to add 5 address rows to an Addresses table for each Employee row.
I've got a junction table much like the permissions example referenced in this Wikipedia article. Pseudo code below...
create table Users (
UserId int primary key,
Username varchar(50)
)
create table Permissions (
PermissionId int primary key,
Description varchar(50)
)
create table UserPermission (
UserPermissionId int primary key,
UserId int, -- foreign key to Users
PermissionId int -- foreign key to Permissions
)
Is it possible to use Visual Studio's Data Generation tool to populate Users, Permissions, and the associated junction table?
Using the GUI, I am only able to populate one of the two related tables by selecting it from the Related Table dropdown for the junction table.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个非常好的工具,允许您在填充数据时强制执行外键引用完整性。尝试一下,也许它会满足您的需求...
http://www.red-gate.com/products/sql-development/sql-data-generator/
This is a pretty good tool that allows you enforce foreign key referencial integrity when populating data. Give the trial a try, maybe it will do what you need...
http://www.red-gate.com/products/sql-development/sql-data-generator/