public static System.Data.IDataReader PageDataLoadByContactSource(CodeFluent.Runtime.PageOptions pageOptions, SoftFluent.SqlServerInMemory.ContactSource contactSource)
 {
     if ((contactSource == null))
     {
         return(null);
     }
     if ((contactSource.Id == -1))
     {
         CodeFluent.Runtime.CodeFluentRuntimeException.Throw("invalidEntityKey", "Id", "contactSource", "SoftFluent.SqlServerInMemory.ContactSource");
     }
     CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.SqlServerInMemory.Constants.SoftFluent_SqlServerInMemoryStoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "Customer", "LoadByContactSource");
     persistence.AddParameter("@ContactSourceId", contactSource.Id, ((int)(-1)));
     if ((pageOptions != null))
     {
         System.Collections.IEnumerator enumerator = pageOptions.OrderByArguments.GetEnumerator();
         bool b;
         int  index = 0;
         for (b = enumerator.MoveNext(); b; b = enumerator.MoveNext())
         {
             CodeFluent.Runtime.OrderByArgument argument = ((CodeFluent.Runtime.OrderByArgument)(enumerator.Current));
             persistence.AddParameter(string.Format("@_orderBy{0}", index), argument.Name);
             persistence.AddParameter(string.Format("@_orderByDirection{0}", index), ((int)(argument.Direction)));
             index = (index + 1);
         }
     }
     System.Data.IDataReader reader = CodeFluentContext.Get(SoftFluent.SqlServerInMemory.Constants.SoftFluent_SqlServerInMemoryStoreName).Persistence.ExecuteReader();
     return(reader);
 }
 public static System.Data.IDataReader PageDataLoadByCardNumber(CodeFluent.Runtime.PageOptions pageOptions, string cardNumber)
 {
     if ((cardNumber == default(string)))
     {
         throw new System.ArgumentNullException("cardNumber");
     }
     CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.EncryptAspect.Constants.SoftFluent_Samples_EncryptAspectStoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "Customer", "LoadByCardNumber");
     persistence.AddParameter("@CardNumber", cardNumber, default(string));
     persistence.AddParameter("@PassPhrase", SoftFluent.Samples.EncryptAspect.PassPhrase.GetPassPhrase(), default(string));
     if ((pageOptions != null))
     {
         System.Collections.IEnumerator enumerator = pageOptions.OrderByArguments.GetEnumerator();
         bool b;
         int  index = 0;
         for (b = enumerator.MoveNext(); b; b = enumerator.MoveNext())
         {
             CodeFluent.Runtime.OrderByArgument argument = ((CodeFluent.Runtime.OrderByArgument)(enumerator.Current));
             persistence.AddParameter(string.Format("@_orderBy{0}", index), argument.Name);
             persistence.AddParameter(string.Format("@_orderByDirection{0}", index), ((int)(argument.Direction)));
             index = (index + 1);
         }
     }
     System.Data.IDataReader reader = CodeFluentContext.Get(SoftFluent.Samples.EncryptAspect.Constants.SoftFluent_Samples_EncryptAspectStoreName).Persistence.ExecuteReader();
     return(reader);
 }
 public static System.Data.IDataReader PageDataLoadByUser(CodeFluent.Runtime.PageOptions pageOptions, SoftFluent.Samples.AspNetIdentity1.User user)
 {
     if ((user == null))
     {
         return(null);
     }
     if ((user.Id == default(string)))
     {
         CodeFluent.Runtime.CodeFluentRuntimeException.Throw("invalidEntityKey", "Id", "user", "SoftFluent.Samples.AspNetIdentity1.User");
     }
     CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.AspNetIdentity1.Constants.SoftFluent_Samples_AspNetIdentity1StoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "ExternalLogin", "LoadByUser");
     persistence.AddParameter("@UserId", user.Id, default(string));
     if ((pageOptions != null))
     {
         System.Collections.IEnumerator enumerator = pageOptions.OrderByArguments.GetEnumerator();
         bool b;
         int  index = 0;
         for (b = enumerator.MoveNext(); b; b = enumerator.MoveNext())
         {
             CodeFluent.Runtime.OrderByArgument argument = ((CodeFluent.Runtime.OrderByArgument)(enumerator.Current));
             persistence.AddParameter(string.Format("@_orderBy{0}", index), argument.Name);
             persistence.AddParameter(string.Format("@_orderByDirection{0}", index), ((int)(argument.Direction)));
             index = (index + 1);
         }
     }
     System.Data.IDataReader reader = CodeFluentContext.Get(SoftFluent.Samples.AspNetIdentity1.Constants.SoftFluent_Samples_AspNetIdentity1StoreName).Persistence.ExecuteReader();
     return(reader);
 }
Exemplo n.º 4
0
        public virtual bool Delete()
        {
            bool ret = false;

            CodeFluent.Runtime.CodeFluentEntityActionEventArgs evt = new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Deleting, true);
            this.OnEntityAction(evt);
            if ((evt.Cancel == true))
            {
                return(ret);
            }
            if ((this.EntityState == CodeFluent.Runtime.CodeFluentEntityState.Deleted))
            {
                return(ret);
            }
            if ((this.RowVersion == null))
            {
                return(ret);
            }
            CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.AspNetIdentity1.Constants.SoftFluent_Samples_AspNetIdentity1StoreName).Persistence;
            persistence.CreateStoredProcedureCommand(null, "User", "Delete");
            persistence.AddParameter("@User_Id", this.Id, default(string));
            persistence.AddParameter("@_rowVersion", this.RowVersion);
            persistence.ExecuteNonQuery();
            this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Deleted;
            this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Deleted, false, false));
            ret = true;
            return(ret);
        }
Exemplo n.º 5
0
 public static SoftFluent.Samples.EncryptAspect.Customer LoadById(System.Guid id)
 {
     if ((id.Equals(CodeFluentPersistence.DefaultGuidValue) == true))
     {
         return(null);
     }
     SoftFluent.Samples.EncryptAspect.Customer customer    = new SoftFluent.Samples.EncryptAspect.Customer();
     CodeFluent.Runtime.CodeFluentPersistence  persistence = CodeFluentContext.Get(SoftFluent.Samples.EncryptAspect.Constants.SoftFluent_Samples_EncryptAspectStoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "Customer", "LoadById");
     persistence.AddParameter("@Id", id, CodeFluentPersistence.DefaultGuidValue);
     persistence.AddParameter("@PassPhrase", SoftFluent.Samples.EncryptAspect.PassPhrase.GetPassPhrase(), default(string));
     System.Data.IDataReader reader = null;
     try
     {
         reader = persistence.ExecuteReader();
         if ((reader.Read() == true))
         {
             customer.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default);
             customer.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
             return(customer);
         }
     }
     finally
     {
         if ((reader != null))
         {
             reader.Dispose();
         }
         persistence.CompleteCommand();
     }
     return(null);
 }
Exemplo n.º 6
0
        public virtual bool Delete()
        {
            SoftFluent.Samples.RedisCache.Product.ClearCache();
            bool ret = false;

            CodeFluent.Runtime.CodeFluentEntityActionEventArgs evt = new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Deleting, true);
            this.OnEntityAction(evt);
            if ((evt.Cancel == true))
            {
                return(ret);
            }
            if ((this.EntityState == CodeFluent.Runtime.CodeFluentEntityState.Deleted))
            {
                return(ret);
            }
            if ((this.RowVersion == null))
            {
                return(ret);
            }
            CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.RedisCache.Constants.SoftFluent_Samples_RedisCacheStoreName).Persistence;
            persistence.CreateStoredProcedureCommand(null, "Product", "Delete");
            persistence.AddParameter("@Product_Id", this.Id, CodeFluentPersistence.DefaultGuidValue);
            persistence.AddParameter("@_rowVersion", this.RowVersion);
            persistence.ExecuteNonQuery();
            this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Deleted;
            this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Deleted, false, false));
            ret = true;
            return(ret);
        }
Exemplo n.º 7
0
 public static System.Data.IDataReader PageDataLoadRolesUsersByUser(CodeFluent.Runtime.PageOptions pageOptions, ModelCodeFluent.Identity.User user)
 {
     if ((user == null))
     {
         return(null);
     }
     if ((user.Id.Equals(CodeFluentPersistence.DefaultGuidValue) == true))
     {
         CodeFluent.Runtime.CodeFluentRuntimeException.Throw("invalidEntityKey", "Id", "user", "ModelCodeFluent.Identity.User");
     }
     CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(ModelCodeFluent.Constants.ModelCodeFluentStoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "Role", "LoadRolesUsersByUser");
     persistence.AddParameter("@UserId", user.Id, CodeFluentPersistence.DefaultGuidValue);
     if ((pageOptions != null))
     {
         System.Collections.IEnumerator enumerator = pageOptions.OrderByArguments.GetEnumerator();
         bool b;
         int  index = 0;
         for (b = enumerator.MoveNext(); b; b = enumerator.MoveNext())
         {
             CodeFluent.Runtime.OrderByArgument argument = ((CodeFluent.Runtime.OrderByArgument)(enumerator.Current));
             persistence.AddParameter(string.Format("@_orderBy{0}", index), argument.Name);
             persistence.AddParameter(string.Format("@_orderByDirection{0}", index), ((int)(argument.Direction)));
             index = (index + 1);
         }
     }
     System.Data.IDataReader reader = CodeFluentContext.Get(ModelCodeFluent.Constants.ModelCodeFluentStoreName).Persistence.ExecuteReader();
     return(reader);
 }
Exemplo n.º 8
0
        public static int DeleteByTypeAndValue(SoftFluent.Samples.AspNetIdentity1.User user, string type, string value)
        {
            if ((user == null))
            {
                throw new System.ArgumentNullException("user");
            }
            if ((user.Id == default(string)))
            {
                CodeFluent.Runtime.CodeFluentRuntimeException.Throw("invalidEntityKey", "Id", "user", "SoftFluent.Samples.AspNetIdentity1.User");
            }
            if ((type == default(string)))
            {
                throw new System.ArgumentNullException("type");
            }
            if ((value == default(string)))
            {
                throw new System.ArgumentNullException("value");
            }
            CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.AspNetIdentity1.Constants.SoftFluent_Samples_AspNetIdentity1StoreName).Persistence;
            persistence.CreateStoredProcedureCommand(null, "UserClaim", "DeleteByTypeAndValue");
            persistence.AddParameter("@UserId", user.Id, default(string));
            persistence.AddParameter("@Type", type, default(string));
            persistence.AddParameter("@Value", value, default(string));
            int count;

            count = persistence.ExecuteScalar(-1);
            return(count);
        }
Exemplo n.º 9
0
        public virtual bool Delete()
        {
            bool ret = false;

            CodeFluent.Runtime.CodeFluentEntityActionEventArgs evt = new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Deleting, true);
            this.OnEntityAction(evt);
            if ((evt.Cancel == true))
            {
                return(ret);
            }
            if ((this.EntityState == CodeFluent.Runtime.CodeFluentEntityState.Deleted))
            {
                return(ret);
            }
            if ((this.RowVersion == null))
            {
                return(ret);
            }
            CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Json.NET.Constants.SoftFluent_Json_NETStoreName).Persistence;
            persistence.CreateStoredProcedureCommand(null, "Publication", "Delete");
            persistence.AddParameter("@Publication_Id", this.Id, ((int)(-1)));
            persistence.AddParameter("@_rowVersion", this.RowVersion);
            persistence.ExecuteNonQuery();
            this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Deleted;
            this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Deleted, false, false));
            ret = true;
            return(ret);
        }
 public static System.Data.IDataReader PageDataLoadSpacesSupportBySupport(CodeFluent.Runtime.PageOptions pageOptions, SoftFluent.Json.NET.Support support)
 {
     if ((support == null))
     {
         return(null);
     }
     if ((support.Id == -1))
     {
         CodeFluent.Runtime.CodeFluentRuntimeException.Throw("invalidEntityKey", "Id", "support", "SoftFluent.Json.NET.Support");
     }
     CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Json.NET.Constants.SoftFluent_Json_NETStoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "Space", "LoadSpacesSupportBySupport");
     persistence.AddParameter("@SupportId", support.Id, ((int)(-1)));
     if ((pageOptions != null))
     {
         System.Collections.IEnumerator enumerator = pageOptions.OrderByArguments.GetEnumerator();
         bool b;
         int  index = 0;
         for (b = enumerator.MoveNext(); b; b = enumerator.MoveNext())
         {
             CodeFluent.Runtime.OrderByArgument argument = ((CodeFluent.Runtime.OrderByArgument)(enumerator.Current));
             persistence.AddParameter(string.Format("@_orderBy{0}", index), argument.Name);
             persistence.AddParameter(string.Format("@_orderByDirection{0}", index), ((int)(argument.Direction)));
             index = (index + 1);
         }
     }
     System.Data.IDataReader reader = CodeFluentContext.Get(SoftFluent.Json.NET.Constants.SoftFluent_Json_NETStoreName).Persistence.ExecuteReader();
     return(reader);
 }
Exemplo n.º 11
0
 public static void SaveLocalizedValues(SoftFluent.Samples.RedisCache.Category entity, int lcid, bool isDefault, string name)
 {
     if ((entity == null))
     {
         throw new System.ArgumentNullException("entity");
     }
     if ((entity.Id.Equals(CodeFluentPersistence.DefaultGuidValue) == true))
     {
         CodeFluent.Runtime.CodeFluentRuntimeException.Throw("invalidEntityKey", "Id", "entity", "SoftFluent.Samples.RedisCache.Category");
     }
     CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.RedisCache.Constants.SoftFluent_Samples_RedisCacheStoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "Category", "SaveLocalizedValues");
     persistence.AddParameter("@entityId", entity.Id, CodeFluentPersistence.DefaultGuidValue);
     persistence.AddParameter("@Lcid", lcid);
     persistence.AddRawParameter("@IsDefault", isDefault);
     persistence.AddParameter("@Name", name, default(string));
     System.Data.IDataReader reader = null;
     try
     {
         reader = persistence.ExecuteReader();
         SoftFluent.Samples.RedisCache.Category.SaveLocalizedValuesUpdateRowVersion(reader, entity, lcid, isDefault, name);
     }
     finally
     {
         if ((reader != null))
         {
             reader.Dispose();
         }
         persistence.CompleteCommand();
     }
 }
 public static System.Data.IDataReader PageDataLoadUsersRolesByRole(CodeFluent.Runtime.PageOptions pageOptions, SoftFluent.Samples.AspNetIdentity2.Role role)
 {
     if ((role == null))
     {
         return(null);
     }
     if ((role.Id.Equals(CodeFluentPersistence.DefaultGuidValue) == true))
     {
         CodeFluent.Runtime.CodeFluentRuntimeException.Throw("invalidEntityKey", "Id", "role", "SoftFluent.Samples.AspNetIdentity2.Role");
     }
     CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.AspNetIdentity2.Constants.SoftFluent_Samples_AspNetIdentity2StoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "User", "LoadUsersRolesByRole");
     persistence.AddParameter("@RoleId", role.Id, CodeFluentPersistence.DefaultGuidValue);
     if ((pageOptions != null))
     {
         System.Collections.IEnumerator enumerator = pageOptions.OrderByArguments.GetEnumerator();
         bool b;
         int  index = 0;
         for (b = enumerator.MoveNext(); b; b = enumerator.MoveNext())
         {
             CodeFluent.Runtime.OrderByArgument argument = ((CodeFluent.Runtime.OrderByArgument)(enumerator.Current));
             persistence.AddParameter(string.Format("@_orderBy{0}", index), argument.Name);
             persistence.AddParameter(string.Format("@_orderByDirection{0}", index), ((int)(argument.Direction)));
             index = (index + 1);
         }
     }
     System.Data.IDataReader reader = CodeFluentContext.Get(SoftFluent.Samples.AspNetIdentity2.Constants.SoftFluent_Samples_AspNetIdentity2StoreName).Persistence.ExecuteReader();
     return(reader);
 }
Exemplo n.º 13
0
        public virtual bool Delete()
        {
            bool ret = false;

            CodeFluent.Runtime.CodeFluentEntityActionEventArgs evt = new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Deleting, true);
            this.OnEntityAction(evt);
            if ((evt.Cancel == true))
            {
                return(ret);
            }
            if ((this.EntityState == CodeFluent.Runtime.CodeFluentEntityState.Deleted))
            {
                return(ret);
            }
            if ((this.RowVersion == null))
            {
                return(ret);
            }
            CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(ModelCodeFluent.Constants.ModelCodeFluentStoreName).Persistence;
            persistence.CreateStoredProcedureCommand(null, "RoleClaim", "Delete");
            persistence.AddParameter("@RoleClaim_Id", this.Id, CodeFluentPersistence.DefaultGuidValue);
            persistence.AddParameter("@_rowVersion", this.RowVersion);
            persistence.ExecuteNonQuery();
            this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Deleted;
            this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Deleted, false, false));
            ret = true;
            return(ret);
        }
Exemplo n.º 14
0
 protected virtual bool BaseSave(bool force)
 {
     if ((this.EntityState == CodeFluent.Runtime.CodeFluentEntityState.ToBeDeleted))
     {
         this.Delete();
         return(false);
     }
     CodeFluent.Runtime.CodeFluentEntityActionEventArgs evt = new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Saving, true);
     this.OnEntityAction(evt);
     if ((evt.Cancel == true))
     {
         return(false);
     }
     CodeFluentPersistence.ThrowIfDeleted(this);
     this.Validate();
     if (((force == false) &&
          (this.EntityState == CodeFluent.Runtime.CodeFluentEntityState.Unchanged)))
     {
         return(false);
     }
     CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(ContactManager.Constants.ContactManagerStoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "Contact", "Save");
     persistence.AddParameter("@Contact_Id", this.Id, ((int)(-1)));
     persistence.AddParameter("@Contact_Email", this.Email, default(string));
     persistence.AddParameter("@Contact_FirstName", this.FirstName, default(string));
     persistence.AddParameter("@Contact_LastName", this.LastName, default(string));
     persistence.AddParameter("@Contact_ContactSource_Id", this.ContactSourceId, ((int)(-1)));
     persistence.AddParameterEnumInt32("@Contact_Status", this.Status, ContactManager.Status.Valid);
     persistence.AddParameter("@Contact_Address_Id", this.AddressId, ((int)(-1)));
     persistence.AddParameter("@Contact_User_Id", this.UserId, ((int)(-1)));
     persistence.AddParameter("@Contact_Description", this.Description, default(string));
     persistence.AddParameter("@_trackLastWriteUser", persistence.Context.User.Name);
     persistence.AddParameter("@_rowVersion", this.RowVersion);
     System.Data.IDataReader reader = null;
     try
     {
         reader = persistence.ExecuteReader();
         if ((reader.Read() == true))
         {
             this.ReadRecordOnSave(reader);
         }
         CodeFluentPersistence.NextResults(reader);
     }
     finally
     {
         if ((reader != null))
         {
             reader.Dispose();
         }
         persistence.CompleteCommand();
     }
     this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Saved, false, false));
     this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
     return(true);
 }
Exemplo n.º 15
0
 protected virtual bool BaseSave(bool force)
 {
     SoftFluent.Samples.RedisCache.Product.ClearCache();
     if ((this.EntityState == CodeFluent.Runtime.CodeFluentEntityState.ToBeDeleted))
     {
         this.Delete();
         return(false);
     }
     CodeFluent.Runtime.CodeFluentEntityActionEventArgs evt = new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Saving, true);
     this.OnEntityAction(evt);
     if ((evt.Cancel == true))
     {
         return(false);
     }
     CodeFluentPersistence.ThrowIfDeleted(this);
     this.Validate();
     if (((force == false) &&
          (this.EntityState == CodeFluent.Runtime.CodeFluentEntityState.Unchanged)))
     {
         return(false);
     }
     CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.RedisCache.Constants.SoftFluent_Samples_RedisCacheStoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "Product", "Save");
     persistence.AddParameter("@Product_Id", this.Id, CodeFluentPersistence.DefaultGuidValue);
     persistence.AddParameter("@Product_Name", this.Name, default(string));
     persistence.AddParameter("@Product_Category_Id", this.CategoryId, CodeFluentPersistence.DefaultGuidValue);
     persistence.AddParameter("@_trackLastWriteUser", persistence.Context.User.Name);
     persistence.AddParameter("@_rowVersion", this.RowVersion);
     System.Data.IDataReader reader = null;
     try
     {
         reader = persistence.ExecuteReader();
         if ((reader.Read() == true))
         {
             this.ReadRecordOnSave(reader);
         }
         CodeFluentPersistence.NextResults(reader);
     }
     finally
     {
         if ((reader != null))
         {
             reader.Dispose();
         }
         persistence.CompleteCommand();
     }
     this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Saved, false, false));
     this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
     return(true);
 }
Exemplo n.º 16
0
 protected virtual bool BaseSave(bool force)
 {
     if ((this.EntityState == CodeFluent.Runtime.CodeFluentEntityState.ToBeDeleted))
     {
         this.Delete();
         return(false);
     }
     CodeFluent.Runtime.CodeFluentEntityActionEventArgs evt = new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Saving, true);
     this.OnEntityAction(evt);
     if ((evt.Cancel == true))
     {
         return(false);
     }
     CodeFluentPersistence.ThrowIfDeleted(this);
     this.Validate();
     if (((force == false) &&
          (this.EntityState == CodeFluent.Runtime.CodeFluentEntityState.Unchanged)))
     {
         return(false);
     }
     CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Json.NET.Constants.SoftFluent_Json_NETStoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "Space", "Save");
     persistence.AddParameter("@Space_Id", this.Id, ((int)(-1)));
     persistence.AddParameter("@Space_Name", this.Name, default(string));
     persistence.AddParameter("@Space_Description", this.Description, default(string));
     persistence.AddParameter("@Space_Width", this.Width, CodeFluentPersistence.DefaultSingleValue);
     persistence.AddParameter("@Space_Height", this.Height, CodeFluentPersistence.DefaultSingleValue);
     persistence.AddParameter("@Space_TVA", this.TVA, CodeFluentPersistence.DefaultSingleValue);
     persistence.AddParameter("@Space_Price", this.Price, CodeFluentPersistence.DefaultDecimalValue);
     persistence.AddParameter("@_trackLastWriteUser", persistence.Context.User.Name);
     persistence.AddParameter("@_rowVersion", this.RowVersion);
     System.Data.IDataReader reader = null;
     try
     {
         reader = persistence.ExecuteReader();
         if ((reader.Read() == true))
         {
             this.ReadRecordOnSave(reader);
         }
         CodeFluentPersistence.NextResults(reader);
     }
     finally
     {
         if ((reader != null))
         {
             reader.Dispose();
         }
         persistence.CompleteCommand();
     }
     this.SaveSupportRelations();
     this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Saved, false, false));
     this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
     return(true);
 }
Exemplo n.º 17
0
        private static SoftFluent.Samples.RedisCache.Category CacheLoadById(bool useCache, System.Guid id)
        {
            if ((id.Equals(CodeFluentPersistence.DefaultGuidValue) == true))
            {
                return(null);
            }
            SoftFluent.Samples.RedisCache.Category category = null;
            string cacheKey = null;

            if ((useCache == true))
            {
                cacheKey = CodeFluent.Runtime.Caching.SimpleCacheManager.BuildCacheKey("b6b0a13b51906622a43903b7f403984a", id);
                category = SoftFluent.Samples.RedisCache.Caching.CacheManager0.Manager.Get("SoftFluent.Samples.RedisCache.Category", cacheKey) as SoftFluent.Samples.RedisCache.Category;
                if ((category != null))
                {
                    return(category);
                }
            }
            category = new SoftFluent.Samples.RedisCache.Category();
            CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.RedisCache.Constants.SoftFluent_Samples_RedisCacheStoreName).Persistence;
            persistence.CreateStoredProcedureCommand(null, "Category", "LoadById");
            persistence.AddParameter("@Id", id, CodeFluentPersistence.DefaultGuidValue);
            persistence.AddParameter("@Lcid", System.Threading.Thread.CurrentThread.CurrentUICulture.LCID, ((int)(1033)));
            System.Data.IDataReader reader = null;
            try
            {
                reader = persistence.ExecuteReader();
                if ((reader.Read() == true))
                {
                    category.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default);
                    category.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
                    if ((useCache == true))
                    {
                        SoftFluent.Samples.RedisCache.Caching.CacheManager0.Manager.Add("SoftFluent.Samples.RedisCache.Category", cacheKey, category, null);
                    }
                    return(category);
                }
            }
            finally
            {
                if ((reader != null))
                {
                    reader.Dispose();
                }
                persistence.CompleteCommand();
            }
            return(null);
        }
Exemplo n.º 18
0
 protected virtual bool BaseSave(bool force)
 {
     if ((this.EntityState == CodeFluent.Runtime.CodeFluentEntityState.ToBeDeleted))
     {
         this.Delete();
         return(false);
     }
     CodeFluent.Runtime.CodeFluentEntityActionEventArgs evt = new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Saving, true);
     this.OnEntityAction(evt);
     if ((evt.Cancel == true))
     {
         return(false);
     }
     CodeFluentPersistence.ThrowIfDeleted(this);
     this.Validate();
     if (((force == false) &&
          (this.EntityState == CodeFluent.Runtime.CodeFluentEntityState.Unchanged)))
     {
         return(false);
     }
     CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(ModelCodeFluent.Constants.ModelCodeFluentStoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "UserClaim", "Save");
     persistence.AddParameter("@UserClaim_Id", this.Id, CodeFluentPersistence.DefaultGuidValue);
     persistence.AddParameter("@UserClaim_Type", this.Type, default(string));
     persistence.AddParameter("@UserClaim_Value", this.Value, default(string));
     persistence.AddParameter("@UserClaim_ValueType", this.ValueType, default(string));
     persistence.AddParameter("@UserClaim_Issuer", this.Issuer, default(string));
     persistence.AddParameter("@UserClaim_OriginalIssuer", this.OriginalIssuer, default(string));
     persistence.AddParameter("@UserClaim_User_Id", this.UserId, CodeFluentPersistence.DefaultGuidValue);
     persistence.AddParameter("@_trackLastWriteUser", persistence.Context.User.Name);
     persistence.AddParameter("@_rowVersion", this.RowVersion);
     System.Data.IDataReader reader = null;
     try
     {
         reader = persistence.ExecuteReader();
         if ((reader.Read() == true))
         {
             this.ReadRecordOnSave(reader);
         }
         CodeFluentPersistence.NextResults(reader);
     }
     finally
     {
         if ((reader != null))
         {
             reader.Dispose();
         }
         persistence.CompleteCommand();
     }
     this.OnEntityAction(new CodeFluent.Runtime.CodeFluentEntityActionEventArgs(this, CodeFluent.Runtime.CodeFluentEntityAction.Saved, false, false));
     this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
     return(true);
 }
Exemplo n.º 19
0
 public static SoftFluent.Samples.Thinktecture.IdentityServer.Role LoadByName(string name)
 {
     if ((name == default(string)))
     {
         return(null);
     }
     SoftFluent.Samples.Thinktecture.IdentityServer.Role role        = new SoftFluent.Samples.Thinktecture.IdentityServer.Role();
     CodeFluent.Runtime.CodeFluentPersistence            persistence = CodeFluentContext.Get(SoftFluent.Samples.Thinktecture.IdentityServer.Constants.SoftFluent_Samples_Thinktecture_IdentityServerStoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "Role", "LoadByName");
     persistence.AddParameter("@Name", name, default(string));
     System.Data.IDataReader reader = null;
     try
     {
         reader = persistence.ExecuteReader();
         if ((reader.Read() == true))
         {
             role.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default);
             role.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
             return(role);
         }
     }
     finally
     {
         if ((reader != null))
         {
             reader.Dispose();
         }
         persistence.CompleteCommand();
     }
     return(null);
 }
Exemplo n.º 20
0
 public static ModelCodeFluent.Vehicle LoadByVehicleId(System.Guid vehicleId)
 {
     if ((vehicleId.Equals(CodeFluentPersistence.DefaultGuidValue) == true))
     {
         return(null);
     }
     ModelCodeFluent.Vehicle vehicle = new ModelCodeFluent.Vehicle();
     CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(ModelCodeFluent.Constants.ModelCodeFluentStoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "Vehicle", "LoadByVehicleId");
     persistence.AddParameter("@VehicleId", vehicleId, CodeFluentPersistence.DefaultGuidValue);
     System.Data.IDataReader reader = null;
     try
     {
         reader = persistence.ExecuteReader();
         if ((reader.Read() == true))
         {
             vehicle.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default);
             vehicle.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
             return(vehicle);
         }
     }
     finally
     {
         if ((reader != null))
         {
             reader.Dispose();
         }
         persistence.CompleteCommand();
     }
     return(null);
 }
Exemplo n.º 21
0
 public static SoftFluent.Json.NET.Publication LoadById(int id)
 {
     if ((id == -1))
     {
         return(null);
     }
     SoftFluent.Json.NET.Publication          publication = new SoftFluent.Json.NET.Publication();
     CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Json.NET.Constants.SoftFluent_Json_NETStoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "Publication", "LoadById");
     persistence.AddParameter("@Id", id, ((int)(-1)));
     System.Data.IDataReader reader = null;
     try
     {
         reader = persistence.ExecuteReader();
         if ((reader.Read() == true))
         {
             publication.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default);
             publication.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
             return(publication);
         }
     }
     finally
     {
         if ((reader != null))
         {
             reader.Dispose();
         }
         persistence.CompleteCommand();
     }
     return(null);
 }
Exemplo n.º 22
0
 public static ContactManager.Address LoadByContact(int contactId)
 {
     if ((contactId == -1))
     {
         return(null);
     }
     ContactManager.Address address = new ContactManager.Address();
     CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(ContactManager.Constants.ContactManagerStoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "Address", "LoadByContact");
     persistence.AddParameter("@ContactId", contactId);
     System.Data.IDataReader reader = null;
     try
     {
         reader = persistence.ExecuteReader();
         if ((reader.Read() == true))
         {
             address.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default);
             address.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
             return(address);
         }
     }
     finally
     {
         if ((reader != null))
         {
             reader.Dispose();
         }
         persistence.CompleteCommand();
     }
     return(null);
 }
Exemplo n.º 23
0
 public static SoftFluent.Json.NET.Support LoadByName(string name)
 {
     if ((name == default(string)))
     {
         return(null);
     }
     SoftFluent.Json.NET.Support support = new SoftFluent.Json.NET.Support();
     CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Json.NET.Constants.SoftFluent_Json_NETStoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "Support", "LoadByName");
     persistence.AddParameter("@Name", name, default(string));
     System.Data.IDataReader reader = null;
     try
     {
         reader = persistence.ExecuteReader();
         if ((reader.Read() == true))
         {
             support.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default);
             support.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
             return(support);
         }
     }
     finally
     {
         if ((reader != null))
         {
             reader.Dispose();
         }
         persistence.CompleteCommand();
     }
     return(null);
 }
Exemplo n.º 24
0
 public static DigitalPicnik.List LoadById(System.Guid id)
 {
     if ((id.Equals(CodeFluentPersistence.DefaultGuidValue) == true))
     {
         return(null);
     }
     DigitalPicnik.List list = new DigitalPicnik.List();
     CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(DigitalPicnik.Constants.DigitalPicnikStoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "List", "LoadById");
     persistence.AddParameter("@Id", id, CodeFluentPersistence.DefaultGuidValue);
     System.Data.IDataReader reader = null;
     try
     {
         reader = persistence.ExecuteReader();
         if ((reader.Read() == true))
         {
             list.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default);
             list.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
             return(list);
         }
     }
     finally
     {
         if ((reader != null))
         {
             reader.Dispose();
         }
         persistence.CompleteCommand();
     }
     return(null);
 }
Exemplo n.º 25
0
 public static SoftFluent.Samples.Thinktecture.IdentityServer.Login LoadById(System.Guid id)
 {
     if ((id.Equals(CodeFluentPersistence.DefaultGuidValue) == true))
     {
         return(null);
     }
     SoftFluent.Samples.Thinktecture.IdentityServer.Login login       = new SoftFluent.Samples.Thinktecture.IdentityServer.Login();
     CodeFluent.Runtime.CodeFluentPersistence             persistence = CodeFluentContext.Get(SoftFluent.Samples.Thinktecture.IdentityServer.Constants.SoftFluent_Samples_Thinktecture_IdentityServerStoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "Login", "LoadById");
     persistence.AddParameter("@Id", id, CodeFluentPersistence.DefaultGuidValue);
     System.Data.IDataReader reader = null;
     try
     {
         reader = persistence.ExecuteReader();
         if ((reader.Read() == true))
         {
             login.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default);
             login.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
             return(login);
         }
     }
     finally
     {
         if ((reader != null))
         {
             reader.Dispose();
         }
         persistence.CompleteCommand();
     }
     return(null);
 }
 public static ContactManager.ContactSource LoadById(int id)
 {
     if ((id == -1))
     {
         return(null);
     }
     ContactManager.ContactSource             contactSource = new ContactManager.ContactSource();
     CodeFluent.Runtime.CodeFluentPersistence persistence   = CodeFluentContext.Get(ContactManager.Constants.ContactManagerStoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "ContactSource", "LoadById");
     persistence.AddParameter("@Id", id, ((int)(-1)));
     System.Data.IDataReader reader = null;
     try
     {
         reader = persistence.ExecuteReader();
         if ((reader.Read() == true))
         {
             contactSource.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default);
             contactSource.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
             return(contactSource);
         }
     }
     finally
     {
         if ((reader != null))
         {
             reader.Dispose();
         }
         persistence.CompleteCommand();
     }
     return(null);
 }
Exemplo n.º 27
0
 public static SoftFluent.Samples.AspNetIdentity2.Role Load(System.Guid id)
 {
     if ((id.Equals(CodeFluentPersistence.DefaultGuidValue) == true))
     {
         return(null);
     }
     SoftFluent.Samples.AspNetIdentity2.Role  role        = new SoftFluent.Samples.AspNetIdentity2.Role();
     CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.AspNetIdentity2.Constants.SoftFluent_Samples_AspNetIdentity2StoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "Role", "Load");
     persistence.AddParameter("@Id", id, CodeFluentPersistence.DefaultGuidValue);
     System.Data.IDataReader reader = null;
     try
     {
         reader = persistence.ExecuteReader();
         if ((reader.Read() == true))
         {
             role.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default);
             role.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
             return(role);
         }
     }
     finally
     {
         if ((reader != null))
         {
             reader.Dispose();
         }
         persistence.CompleteCommand();
     }
     return(null);
 }
Exemplo n.º 28
0
 public static SoftFluent.Samples.ExtendedSearch.Customer LoadById(int id)
 {
     if ((id == -1))
     {
         return(null);
     }
     SoftFluent.Samples.ExtendedSearch.Customer customer    = new SoftFluent.Samples.ExtendedSearch.Customer();
     CodeFluent.Runtime.CodeFluentPersistence   persistence = CodeFluentContext.Get(SoftFluent.Samples.ExtendedSearch.Constants.SoftFluent_Samples_ExtendedSearchStoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "Customer", "LoadById");
     persistence.AddParameter("@Id", id, ((int)(-1)));
     System.Data.IDataReader reader = null;
     try
     {
         reader = persistence.ExecuteReader();
         if ((reader.Read() == true))
         {
             customer.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default);
             customer.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
             return(customer);
         }
     }
     finally
     {
         if ((reader != null))
         {
             reader.Dispose();
         }
         persistence.CompleteCommand();
     }
     return(null);
 }
Exemplo n.º 29
0
 public static ContactManager.User LoadByEmail(string email)
 {
     if ((email == default(string)))
     {
         return(null);
     }
     ContactManager.User user = new ContactManager.User();
     CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(ContactManager.Constants.ContactManagerStoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "User", "LoadByEmail");
     persistence.AddParameter("@Email", email, default(string));
     System.Data.IDataReader reader = null;
     try
     {
         reader = persistence.ExecuteReader();
         if ((reader.Read() == true))
         {
             user.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default);
             user.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
             return(user);
         }
     }
     finally
     {
         if ((reader != null))
         {
             reader.Dispose();
         }
         persistence.CompleteCommand();
     }
     return(null);
 }
Exemplo n.º 30
0
 public static ModelCodeFluent.Identity.RoleClaim LoadById(System.Guid id)
 {
     if ((id.Equals(CodeFluentPersistence.DefaultGuidValue) == true))
     {
         return(null);
     }
     ModelCodeFluent.Identity.RoleClaim       roleClaim   = new ModelCodeFluent.Identity.RoleClaim();
     CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(ModelCodeFluent.Constants.ModelCodeFluentStoreName).Persistence;
     persistence.CreateStoredProcedureCommand(null, "RoleClaim", "LoadById");
     persistence.AddParameter("@Id", id, CodeFluentPersistence.DefaultGuidValue);
     System.Data.IDataReader reader = null;
     try
     {
         reader = persistence.ExecuteReader();
         if ((reader.Read() == true))
         {
             roleClaim.ReadRecord(reader, CodeFluent.Runtime.CodeFluentReloadOptions.Default);
             roleClaim.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged;
             return(roleClaim);
         }
     }
     finally
     {
         if ((reader != null))
         {
             reader.Dispose();
         }
         persistence.CompleteCommand();
     }
     return(null);
 }