2012-04-02 8 views
2

マイニング構造を2008サーバーから2012サーバーに移行しました。私は2012サーバー上のDMXクエリで(SQL Server 2008で正常に動作している)私のCLR UDFをしようとすると、私はこのエラーを取得しています:Context.CurrentMiningModelはUDFでnullを返します

Exception has been thrown by the target of an invocation. Object reference not set to an instance of an object.

私の本来の目的は、GetNodeDescription(...)メソッドの実行を取得することでした。問題をデバッグしている間、私は私のSQLサーバーに障害が発生し、このUDFに問題を切り分けることができ2012

[SafeToPrepare(true)] 
public static string test() 
{ 
    return Context.CurrentMiningModel.Name; 
} 

私の推測では、次のコードは、上の

[SafeToPrepare(true)] 
public static string testUser() 
{ 
return Context.CurrentConnection.User.Name; 
} 

任意のアイデア正常に動作しますので、CurrentMiningModelがnullであるということですこれを解決するには? これを再現できる人は誰ですか?

ありがとうございました。

UPDATE:マイクロソフトの 接触は、「メタデータ・リファクタリング」(これはあらゆる手段を...)に起因して、必要に応じて、この動作を確認しました。しかし、websiteはまだ適切に更新されています。

答えて

0

これは究極の答えではないが、それは(明示的にマイニングモデルを提供することで)MicrosoftのGetNodeDescription作業を取得するための回避策です:

[SafeToPrepare(true)] 
public static string GetNodeDescription(string MiningModel, string nodeUniqueName) 
{ 
    if (Context.ExecuteForPrepare) 
    { 
    return string.Empty; 
    } 
    return Context.MiningModels[MiningModel].GetNodeFromUniqueName(nodeUniqueName).Descript‌​ion; 
} 
関連する問題