internal static void UpdateDatabaseMetaProperty(string connectionString, string propertyName, string propertyValue) { System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection(); try { var settings = new nHydrateSetting(); settings.Load(connectionString); switch (propertyName) { case "dbVersion": settings.dbVersion = propertyValue; break; case "LastUpdate": settings.LastUpdate = DateTime.Parse(propertyValue); break; case "ModelKey": settings.ModelKey = new Guid(propertyValue); break; case "History": settings.LoadHistory(propertyValue); break; default: throw new Exception("No property found!"); } settings.Save(connectionString); } catch (Exception ex) { throw; } finally { if (conn != null) conn.Close(); } //We no longer use extended properties if (CanUseExtendedProperty(connectionString)) { if (ExtendedPropertyExists(connectionString, propertyName, string.Empty, string.Empty, string.Empty)) { //UpdateExtendedProperty(connectionString, propertyName, propertyValue, string.Empty, string.Empty, string.Empty); DeleteExtendedProperty(connectionString, propertyName); } else { //InsertExtendedPropery(connectionString, propertyName, propertyValue, string.Empty, string.Empty, string.Empty); } } }
internal static List<HistoryItem> GetHistory(string connectionString) { var retval = new List<HistoryItem>(); var settings = new nHydrateSetting(); if (CanUseExtendedProperty(connectionString)) { var historyRow = SqlServers.SelectExtendedProperty(connectionString, "History", string.Empty, string.Empty, string.Empty); settings.LoadHistory(historyRow); if (settings.History.Count > 0) return settings.History; } if (settings.History.Count == 0) { settings = new nHydrateSetting(); settings.Load(connectionString); } return settings.History; }