我需要什么来子类化迁移?
关注 http://subsonicproject.com/docs/Using_SimpleRepository 上发布的迁移视频
我正在 下载了最新的 SubSonic (3.0.0.4),并在 VS 2010 中的空控制台应用程序项目中提取/引用了 SubSonic.Core.dll。
我在 Migrations 文件夹中创建了一个 001_Init.cs 文件:
using System;
using System.Collections.Generic;
//using System.Linq;
using System.Text;
using SubSonic;
namespace SubSonic.Migrations
{
class _001_Init : Migration
{
}
}
但我得到:
错误 1 类型或命名空间名称 找不到“迁移”(是 你缺少一个 using 指令或 集会 参考?) C:\dev\SubSonic\SubSonic\Migrations\001_Init.cs 9 23 SubSonic
在我的 Program.cs 文件中,我设法通过 var repo = new SimpleRepository("Northwind ");
所以我知道 dll 被正确引用。
我缺少什么?或者,是否有我没有看到的有关此内容的文档?
I'm following the Migration video posted at http://subsonicproject.com/docs/Using_SimpleRepository
I've downloaded the latest SubSonic (3.0.0.4), and extracted/referenced the SubSonic.Core.dll in my empty Console Application project in VS 2010.
I've created a 001_Init.cs file in the Migrations folder:
using System;
using System.Collections.Generic;
//using System.Linq;
using System.Text;
using SubSonic;
namespace SubSonic.Migrations
{
class _001_Init : Migration
{
}
}
But I'm getting:
Error 1 The type or namespace name
'Migration' could not be found (are
you missing a using directive or an
assembly
reference?) C:\dev\SubSonic\SubSonic\Migrations\001_Init.cs 9 23 SubSonic
In my Program.cs file I've managed to add a few rows to my DB via var repo = new SimpleRepository("Northwind");
so I know the dll is referenced properly.
What am I missing? Alternatively, is there documentation about this that I'm not seeing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
迁移是 SubSonic 2 的一项功能,尚未移植到 SubSonic 3。
http://subsonicproject.com/docs/Migrations< /a>
SubSonic 3 的 SimpleRepository 具有迁移功能,但不会为您提供相同的控制(它只是比较您当前的 DTO 并计算转换相应的数据库方案以匹配它们所需的步骤。
http://subsonicproject.com/docs/3.0_Migrations
但是,由于迁移是一个独立功能,可以与或不与 subsonic 本身一起使用,我建议您使用 subsonic 2 的 sonic.exe 来执行迁移,并使用 subsonic 3 来执行其余操作。
Migrations are a SubSonic 2 feature that has not been ported to SubSonic 3.
http://subsonicproject.com/docs/Migrations
SubSonic 3's SimpleRepository has a Migration feature that does not give you the same control (it just compares your current DTO's and calculates what steps are needed to convert the corresponding database scheme to match them.
http://subsonicproject.com/docs/3.0_Migrations
However, since migrations are a standalone feature that can be used with or without subsonic itself, I would suggest you use subsonic 2's sonic.exe to execute your migrations and use SubSonic 3 for the rest.