Inheritance: System.Data.Objects.DataClasses.EntityObject
Esempio n. 1
0
        /// <summary>
        /// Create a new elmcity_log_entry object.
        /// </summary>
        /// <param name="datetime">Initial value of the datetime property.</param>
        /// <param name="ticks">Initial value of the ticks property.</param>
        public static elmcity_log_entry Createelmcity_log_entry(global::System.DateTime datetime, global::System.Int64 ticks)
        {
            elmcity_log_entry elmcity_log_entry = new elmcity_log_entry();

            elmcity_log_entry.datetime = datetime;
            elmcity_log_entry.ticks    = ticks;
            return(elmcity_log_entry);
        }
 /// <summary>
 /// Deprecated Method for adding a new object to the elmcity_log_entry EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToelmcity_log_entry(elmcity_log_entry elmcity_log_entry)
 {
     base.AddObject("elmcity_log_entry", elmcity_log_entry);
 }
 /// <summary>
 /// Create a new elmcity_log_entry object.
 /// </summary>
 /// <param name="datetime">Initial value of the datetime property.</param>
 /// <param name="ticks">Initial value of the ticks property.</param>
 public static elmcity_log_entry Createelmcity_log_entry(global::System.DateTime datetime, global::System.Int64 ticks)
 {
     elmcity_log_entry elmcity_log_entry = new elmcity_log_entry();
     elmcity_log_entry.datetime = datetime;
     elmcity_log_entry.ticks = ticks;
     return elmcity_log_entry;
 }
Esempio n. 4
0
 /// <summary>
 /// Deprecated Method for adding a new object to the elmcity_log_entry EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToelmcity_log_entry(elmcity_log_entry elmcity_log_entry)
 {
     base.AddObject("elmcity_log_entry", elmcity_log_entry);
 }
Esempio n. 5
0
        public static void PurgeAndMaybeTransferToSqlAzure(bool transfer, DateTime since, DateTime until)
        {
            GenUtils.LogMsg("info", "elmcity_logs.TransferToSqlAzure", null);

            var model_name = "elmcity_log_entry";
            var conn_str = GenUtils.MakeEntityConnectionString(model_name);
            var entities = new elmcity_log_entry_entities(conn_str);

            var ts = TableStorage.MakeDefaultTableStorage();
            var tablename = Configurator.azure_log_table;

            var q = String.Format("$filter=(PartitionKey eq 'log' and RowKey gt '{0}' and RowKey lt '{1}')", since.Ticks, until.Ticks);
            var ts_response = ts.QueryAllEntitiesAsListDict(tablename, q);
            string rowkey = null;

            elmcity_log_entry elmcity_log_entry;

            foreach (var dict in ts_response.list_dict_obj)
            {
                rowkey = (String)dict["RowKey"];
                ts.MaybeDeleteEntity(tablename, tablename, rowkey);
                if (transfer == false)
                    continue;

                elmcity_log_entry = default(elmcity_log_entry);
                int db_result = -1;
                try
                {
                    elmcity_log_entry = new elmcity_log_entry();
                    elmcity_log_entry.ticks = Convert.ToInt64(dict["RowKey"]);
                    elmcity_log_entry.datetime = (DateTime)dict["Timestamp"];
                    elmcity_log_entry.type = (String)dict["type"];
                    elmcity_log_entry.message = (String)dict["message"];
                    elmcity_log_entry.data = (String)dict["data"];
                }
                catch (Exception ex_log)
                {
                    GenUtils.PriorityLogMsg("exception", "elmcity_logs.TransferToSqlAzure", ex_log.Message + ex_log.InnerException.Message);
                }

                try
                {

                    entities.AddObject(entitySetName: model_name, entity: elmcity_log_entry);
                    db_result = entities.SaveChanges();
                    if (db_result != 1)
                        GenUtils.LogMsg("warning", "elmcity_logs.TransferToSqlAzure expected 1 but got " + db_result.ToString(), null);
                }
                catch (Exception ex_db)
                {
                    GenUtils.PriorityLogMsg("exception", "elmcity_logs.TransferToSqlAzure SaveChanges", ex_db.Message + ex_db.InnerException.Message + ex_db.StackTrace);
                }
            }
        }