当我的密钥名称(索引,主键和外键)由Add-Migration生成时,我不能有[.](句点),所以我尝试编写CSharpMigrationCodeGenerator,但不幸的是,这似乎不允许您要更改外键或索引名称.主键名称可以设置为覆盖create table的一部分:
protected override void Generate(
CreateTableOperation createTableOperation, IndentedTextWriter writer)
{
createTableOperation.PrimaryKey.Name = "USE THIS NAME";
base.Generate(createTableOperation, writer);
}
Run Code Online (Sandbox Code Playgroud)
但我真正需要的是一种方法来确保它刚刚删除完全停止(这意味着覆盖自定义名称生成器) - 但我看不到如何做到这一点.
我需要一些帮助 - 我试图在需要进行数据库调用的ASP.NET MVC Web项目中使用自定义验证属性.
我有windsor成功地为控制器工作,并正常注入IRepository接口.当我需要将存储库注入属性类时,问题就出现了.
属性类具有以下代码:
public class ValidateUniqueUrlNodeAttribute : AbstractValidationAttribute
{
private readonly string message;
private readonly IArticleRepository articleRepository;
public ValidateUniqueUrlNodeAttribute(string message)
{
this.message = message;
}
public ValidateUniqueUrlNodeAttribute(string message, IArticleRepository articleRepository):this(message)
{
this.articleRepository = articleRepository;
}
public override IValidator Build()
{
var validator = new UniqueUrlNodeValidator(articleRepository) { ErrorMessage = message };
ConfigureValidatorMessage(validator);
return validator;
}
Run Code Online (Sandbox Code Playgroud)
我的问题是我似乎无法让Windsor拦截传递给IArticleRepository的属性的构造
我的global.asax文件中的当前代码如下:
container = new WindsorContainer();
ControllerBuilder.Current.SetControllerFactory(new WindsorControllerFactory(Container));
container
.RegisterControllers(Assembly.GetExecutingAssembly())
.AddComponent<IArticleRepository, ArticleRepository>()
.AddComponent<ValidateUniqueUrlNodeAttribute>();
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激.
我是GIT的新手,想知道如何获得最新版本的主干并且放弃我所有的变化.
我似乎得到的只是notuptodate错误.我不想保存旧的变化......
我也明白了Your branch is behind 'origin/master' by 15 commits, and can be fast-forwarded.我如何快进?同样,我并不关心我所做的改变.
非常感谢,因为我目前在SO上的答案似乎假设你希望保持变化
错误示例(以及已经尝试过的事情)
$ git checkout
$ git pull
Updating 69edec1..dc3fdfe error: Entry 'src/FluentNHibernate.Testing/DomainModel/Mapping/CompositeIdentityPartTester.cs' not uptodate. Cannot merge.
$ git checkout -- src/FluentNHibernate.Testing/DomainModel/Mapping/CompositeIdentityPartTester.cs
$ git pull
Updating 69edec1..dc3fdfe error: Entry 'src/FluentNHibernate.Testing/DomainModel/Mapping/CompositeIdentityPartTester.cs' not uptodate. Cannot merge.
$ git reset --hard
$ git pull
Updating 69edec1..dc3fdfe error: Entry 'src/FluentNHibernate.Testing/DomainModel/Mapping/CompositeIdentityPartTester.cs' not uptodate. Cannot merge.
Run Code Online (Sandbox Code Playgroud)
修复:我似乎通过使用gitk --all和使用GUI对最新的更改进行硬重置来解决问题...我仍然真的想了解为什么命令行不会这样做?