0

どうやら、このメソッドは呼び出されなくなりました...そこには、AutoMapper を構成するためのコードと、モデル バインダーを設定するためのコードがあります。

モデルバインダーを実行する「新しい」方法があることは知っていますが、それを実装するまでは「古い方法」で実行できるはずではありませんか?

具体的には、以前の Application_Start() メソッドから 2 行が残っており、これを機能させることができませんでした。

        AutoMapperConfiguration.Configure();

        ModelBinders.Binders[typeof (ModuleEditModel)] = new DerivedModelBinder();

ServiceLocatorManager.SetLocatorProvider(() => new StructureMapServiceLocator()); の呼び出しの直後に、コンストラクターに単純にポップしようとしました。

そして、それは実行されますが..どういうわけか効果がないようです。アプリケーションを実行すると、AutoMapper が適切でないこと、本来あるべきマッピングがないことなどは明らかです。

4

1 に答える 1

1

この質問には、CodePlex の Turbine ディスカッション ボードで回答しました。あなたが求める変更を行うためのソースは次のとおりです。

public class MvcApplication : TurbineApplication {
    static MvcApplication() {
        // Register the IoC that you want Mvc Turbine to use!
        // Everything else is wired automatically

        // For now, let's use the Unity IoC
        ServiceLocatorManager.SetLocatorProvider(() => new UnityServiceLocator());
    }

    public override void Startup(){
         // Gets called when the application starts up
         // and before all the stuff that Turbine wires up
    }

    public override void Shutdown() {
         // Gets called when the application shuts down
         // and before any cleanup is done by Turbine
    }
}

お役に立てれば!

于 2010-07-14T19:19:32.283 に答える