2015-07-03 70 views
0

我有這個疑問:Neo4jClient C#哪裏有設置動態

var query = client.Cypher 
       .Match("(store:Store)") 
       .Where("has(store.en_GB)") 
       .Return<Store>("store"); 

     return query.Results.ToList(); 

我要的是「EN_GB」,能夠從一個叫做語言環境變量設置,但我不知道如何做到這一點是可能。

我想這可能是因爲

.Where("has(store.{param})") 
.WithParam("param",region) 

,但沒有工作那麼簡單,所以是有可能。請幫忙。

回答

1

是這樣的嗎?

var locale = "en_GB"; 

var query = client.Cypher 
       .Match("(store:Store)") 
       .Where(String.Format("has(store.{0})", locale)) 
       .Return<Store>("store"); 

     return query.Results.ToList(); 
+0

是的,這個總結得很完美,謝謝。 –