Ejemplo n.º 1
0
        /// <summary>
        /// 添加记录
        /// </summary>
        #region bool DAO_Add(T entity)
        public static bool DAO_Add(T entity)
        {
            try
            {
                ActiveRecordBase <T> .Save(entity);

                return(true);
            }
            catch (Exception ex)
            {
                //LogHelper.WriteLog(LogTag + ".DAO_Add(T entity) ", ex);
                return(false);
            }
        }
Ejemplo n.º 2
0
        internal static void SaveInstance(object instance,
                                          Controller controller, ArrayList errors, IDictionary prop2Validation)
        {
            if (instance is ActiveRecordValidationBase)
            {
                ActiveRecordValidationBase instanceBase = instance as ActiveRecordValidationBase;

                if (!instanceBase.IsValid())
                {
                    errors.AddRange(instanceBase.ValidationErrorMessages);
                    prop2Validation = instanceBase.PropertiesValidationErrorMessage;
                }
                else
                {
                    instanceBase.Save();
                }
            }
            else
            {
                ActiveRecordBase instanceBase = instance as ActiveRecordBase;

                instanceBase.Save();
            }
        }
Ejemplo n.º 3
0
 public static void SaveLater(this ActiveRecordBase record)
 {
     RealmServer.IOQueue.AddMessage(() => record.Save());                                // leave it as a Lambda Expr to get a complete stacktrace
 }
Ejemplo n.º 4
0
 public static void SaveLater(this ActiveRecordBase record)
 {
     ServerApp <WCell.RealmServer.RealmServer> .IOQueue.AddMessage((Action)(() => record.Save()));
 }