public static void Register(HttpConfiguration config) { // Web API configuration and services // Web API routes config.MapHttpAttributeRoutes(); config.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); config.Formatters.JsonFormatter.SerializerSettings.NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore; var appXmlType = config.Formatters.XmlFormatter.SupportedMediaTypes.FirstOrDefault(t => t.MediaType == Neo4jSettings.METADATA_TYPE); config.Formatters.XmlFormatter.SupportedMediaTypes.Remove(appXmlType); //Use an IoC container and register as a Singleton string url = Properties.Settings.Default.GraphDBUrl; string user = Properties.Settings.Default.GraphDBUser; string password = Properties.Settings.Default.GraphDBPassword; IGraphClient client = new GraphClient(new Uri(url), user, password); client.Connect(); GraphClient = client; DataService = new Neo4jDataService(GraphClient); Cache = new Neo4jCacheQuery(); Helper = new Neo4jHelper(DataService, Cache); }
private string saveNeo(Dictionary <string, string> paramDict) { if (currentTopic.Equals("")) { MessageBox.Show("请选择主题"); return("fail"); } var eventList = DBHelper.db.Queryable <Event>() .Where(it => it.topic == currentTopic) .OrderBy(it => it.time).ToList(); Neo4jHelper neoHelper = new Neo4jHelper(); neoHelper.saveTopic(eventList); return("success"); }
/// <summary> /// 关系网图的保存按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void saveData_Click(object sender, EventArgs e) { Neo4jHelper neoHelper = new Neo4jHelper(); List <Entity> entityList = new List <Entity>(); foreach (Control c in relNetPanel.Controls) { if (c is Label) { Entity entity = new Entity(); entity.Name = c.Text; entityList.Add(entity); } } neoHelper.createUniqueEntity(entityList); neoHelper.createEntityRel(entityList); }