Exemplo n.º 1
0
 /// <summary>
 /// It's required ? I'm not sure !!!
 /// </summary>
 /// <param name="metadata"></param>
 internal void Add(Metadata metadata)
 {
     using (var dbContext = new MedialynxDbMetadataContext()) {
         dbContext.Metadata.Add(metadata);
         dbContext.SaveChanges();
     }
 }
Exemplo n.º 2
0
        private static void ApplySinglePatch(int metadataOrder, string patchId, string scriptBody)
        {
            using (var dbContext = new MedialynxDbMetadataContext()) {
                // Execute patch query
                using (MySqlConnection connection = new MySqlConnection(BaseDbContext.ConnectionString)){
                    connection.Open();
                    using (var cmd = connection.CreateCommand()) {
                        cmd.CommandText = scriptBody;
                        cmd.ExecuteNonQuery();
                    }
                }

                // Save metadata object
                Metadata md = new Metadata();
                md.Id            = Guid.NewGuid().ToString("B");
                md.MetadataOrder = metadataOrder;
                md.Comment       = "Patch applied: " + patchId;
                md.Data          = scriptBody;
                md.CreationDate  = DateTime.UtcNow;

                dbContext.Metadata.Add(md);
                dbContext.SaveChanges();

                // Add history log
                Program.MedialynxData.historyDBAPI.Add(
                    new HistoryItem(
                        "n/a",
                        md.Id,
                        typeof(Metadata).ToString(),
                        "Patch applied: " + patchId
                        )
                    );
            }
        }