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); }
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); }
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 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); }
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, "Campaign", "Save"); persistence.AddParameter("@Campaign_Id", this.Id, ((int)(-1))); persistence.AddParameter("@Campaign_Name", this.Name, default(string)); persistence.AddParameterEnumInt32("@Campaign_State", this.State, SoftFluent.Json.NET.CampaignStateType.Conceived); persistence.AddParameter("@Campaign_Customer_Id", this.CustomerId, ((int)(-1))); persistence.AddParameter("@Campaign_Price", this.Price, CodeFluentPersistence.DefaultDecimalValue); persistence.AddParameter("@Campaign_PriceAllTaxIncluded", this.PriceAllTaxIncluded, CodeFluentPersistence.DefaultDecimalValue); persistence.AddParameter("@Campaign_DiscountRate", this.DiscountRate, CodeFluentPersistence.DefaultDecimalValue); persistence.AddParameter("@Campaign_ConceptionDate", this.ConceptionDate, CodeFluentPersistence.DefaultDateTimeValue); persistence.AddParameter("@Campaign_AddressedDate", this.AddressedDate, CodeFluentPersistence.DefaultDateTimeValue); persistence.AddParameter("@Campaign_PropositionDate", this.PropositionDate, CodeFluentPersistence.DefaultDateTimeValue); persistence.AddParameter("@Campaign_ConfirmationDate", this.ConfirmationDate, CodeFluentPersistence.DefaultDateTimeValue); 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); }
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, "Customer", "Save"); persistence.AddParameter("@Customer_Id", this.Id, ((int)(-1))); persistence.AddParameter("@Customer_Name", this.Name, default(string)); persistence.AddParameter("@Customer_Address", this.Address, default(string)); persistence.AddParameter("@Customer_City", this.City, default(string)); persistence.AddParameter("@Customer_ZipCode", this.ZipCode, default(string)); persistence.AddParameter("@Customer_Country", this.Country, default(string)); persistence.AddParameter("@Customer_Phone", this.Phone, default(string)); persistence.AddParameter("@Customer_Fax", this.Fax, default(string)); persistence.AddParameter("@Customer_WebSite", this.WebSite, default(string)); persistence.AddParameterEnumInt32("@Customer_Language", this.Language, SoftFluent.Json.NET.Language.French); persistence.AddParameterEnumInt32("@Customer_CustomerType", this.CustomerType, SoftFluent.Json.NET.CustomerType.Client); 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); }
protected internal void OnEntityDeserializing(System.Runtime.Serialization.StreamingContext context) { this.IsDeserializing = true; this._id = -1; this._name = default(string); this._raisePropertyChangedEvents = true; this._entityState = CodeFluent.Runtime.CodeFluentEntityState.Created; this._raisePropertyChangedEvents = true; }
private void LoadSupportSpacesBySpace(int pageIndex, int pageSize, CodeFluent.Runtime.PageOptions pageOptions, System.Data.IDataReader reader, SoftFluent.Json.NET.Space space) { if ((reader == null)) { throw new System.ArgumentNullException("reader"); } if ((pageIndex < 0)) { pageIndex = 0; } if ((pageSize < 0)) { if ((pageOptions != null)) { pageSize = pageOptions.DefaultPageSize; } else { pageSize = int.MaxValue; } } CodeFluent.Runtime.CodeFluentEntityState spaceState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; if ((space != null)) { spaceState = space.EntityState; } this._supportSpaceSpaces = space; this.BaseList.Clear(); this.BaseTable.Clear(); int count = 0; int readCount = 0; bool readerRead; for (readerRead = reader.Read(); ((readerRead == true) && ((count < this.MaxCount) && (count < pageSize))); readerRead = reader.Read()) { readCount = (readCount + 1); if ((CodeFluent.Runtime.CodeFluentPersistence.CanAddEntity(pageIndex, pageSize, pageOptions, readCount) == true)) { SoftFluent.Json.NET.Support support = new SoftFluent.Json.NET.Support(); ((CodeFluent.Runtime.ICodeFluentEntity)(support)).ReadRecord(reader); if ((this.BaseContains(support) == false)) { this.BaseAdd(support); count = (count + 1); } support.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; } } if ((space != null)) { space.EntityState = spaceState; } }
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.Samples.GED.Constants.SoftFluent_Samples_GEDStoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "Document", "Save"); persistence.AddParameter("@Document_Id", this.Id, CodeFluentPersistence.DefaultGuidValue); persistence.AddParameter("@Document_Text", this.Text, default(string)); persistence.AddParameter("@Document_User_Id", this.UserId, CodeFluentPersistence.DefaultGuidValue); persistence.AddParameter("@Document_Title", this.Title, default(string)); persistence.AddParameter("@Document_Directory_Id", this.DirectoryId, CodeFluentPersistence.DefaultGuidValue); persistence.AddParameter("@Document_Reference", this.Reference, default(string)); persistence.AddParameter("@Document_Token", this.Token, default(string)); persistence.AddRawParameter("@Document_IsProcessed", this.IsProcessed); persistence.AddRawParameter("@Document_IsReady", this.IsReady); 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); }
private void LoadByList(int pageIndex, int pageSize, CodeFluent.Runtime.PageOptions pageOptions, System.Data.IDataReader reader, DigitalPicnik.List list) { if ((reader == null)) { throw new System.ArgumentNullException("reader"); } if ((pageIndex < 0)) { pageIndex = 0; } if ((pageSize < 0)) { if ((pageOptions != null)) { pageSize = pageOptions.DefaultPageSize; } else { pageSize = int.MaxValue; } } CodeFluent.Runtime.CodeFluentEntityState listState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; if ((list != null)) { listState = list.EntityState; } this._itemsListList = list; this.BaseList.Clear(); this.BaseTable.Clear(); int count = 0; int readCount = 0; bool readerRead; for (readerRead = reader.Read(); ((readerRead == true) && ((count < this.MaxCount) && (count < pageSize))); readerRead = reader.Read()) { readCount = (readCount + 1); if ((CodeFluent.Runtime.CodeFluentPersistence.CanAddEntity(pageIndex, pageSize, pageOptions, readCount) == true)) { DigitalPicnik.Item item = new DigitalPicnik.Item(); ((CodeFluent.Runtime.ICodeFluentEntity)(item)).ReadRecord(reader); if ((this.BaseContains(item) == false)) { this.BaseAdd(item); count = (count + 1); } item.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; } } if ((list != null)) { list.EntityState = listState; } }
private void LoadByContactSource(int pageIndex, int pageSize, CodeFluent.Runtime.PageOptions pageOptions, System.Data.IDataReader reader, SoftFluent.SqlServerInMemory.ContactSource contactSource) { if ((reader == null)) { throw new System.ArgumentNullException("reader"); } if ((pageIndex < 0)) { pageIndex = 0; } if ((pageSize < 0)) { if ((pageOptions != null)) { pageSize = pageOptions.DefaultPageSize; } else { pageSize = int.MaxValue; } } CodeFluent.Runtime.CodeFluentEntityState contactSourceState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; if ((contactSource != null)) { contactSourceState = contactSource.EntityState; } this._unspecifiedContactSourceContactSource = contactSource; this.BaseList.Clear(); this.BaseTable.Clear(); int count = 0; int readCount = 0; bool readerRead; for (readerRead = reader.Read(); ((readerRead == true) && ((count < this.MaxCount) && (count < pageSize))); readerRead = reader.Read()) { readCount = (readCount + 1); if ((CodeFluent.Runtime.CodeFluentPersistence.CanAddEntity(pageIndex, pageSize, pageOptions, readCount) == true)) { SoftFluent.SqlServerInMemory.Customer customer = new SoftFluent.SqlServerInMemory.Customer(); ((CodeFluent.Runtime.ICodeFluentEntity)(customer)).ReadRecord(reader); if ((this.BaseContains(customer) == false)) { this.BaseAdd(customer); count = (count + 1); } customer.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; } } if ((contactSource != null)) { contactSource.EntityState = contactSourceState; } }
private void LoadRolesUsersByUser(int pageIndex, int pageSize, CodeFluent.Runtime.PageOptions pageOptions, System.Data.IDataReader reader, ModelCodeFluent.Identity.User user) { if ((reader == null)) { throw new System.ArgumentNullException("reader"); } if ((pageIndex < 0)) { pageIndex = 0; } if ((pageSize < 0)) { if ((pageOptions != null)) { pageSize = pageOptions.DefaultPageSize; } else { pageSize = int.MaxValue; } } CodeFluent.Runtime.CodeFluentEntityState userState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; if ((user != null)) { userState = user.EntityState; } this._rolesUserUsers = user; this.BaseList.Clear(); this.BaseTable.Clear(); int count = 0; int readCount = 0; bool readerRead; for (readerRead = reader.Read(); ((readerRead == true) && ((count < this.MaxCount) && (count < pageSize))); readerRead = reader.Read()) { readCount = (readCount + 1); if ((CodeFluent.Runtime.CodeFluentPersistence.CanAddEntity(pageIndex, pageSize, pageOptions, readCount) == true)) { ModelCodeFluent.Identity.Role role = new ModelCodeFluent.Identity.Role(); ((CodeFluent.Runtime.ICodeFluentEntity)(role)).ReadRecord(reader); if ((this.BaseContains(role) == false)) { this.BaseAdd(role); count = (count + 1); } role.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; } } if ((user != null)) { user.EntityState = userState; } }
private void LoadUsersRolesByRole(int pageIndex, int pageSize, CodeFluent.Runtime.PageOptions pageOptions, System.Data.IDataReader reader, SoftFluent.Samples.AspNetIdentity2.Role role) { if ((reader == null)) { throw new System.ArgumentNullException("reader"); } if ((pageIndex < 0)) { pageIndex = 0; } if ((pageSize < 0)) { if ((pageOptions != null)) { pageSize = pageOptions.DefaultPageSize; } else { pageSize = int.MaxValue; } } CodeFluent.Runtime.CodeFluentEntityState roleState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; if ((role != null)) { roleState = role.EntityState; } this._usersRoleRoles = role; this.BaseList.Clear(); this.BaseTable.Clear(); int count = 0; int readCount = 0; bool readerRead; for (readerRead = reader.Read(); ((readerRead == true) && ((count < this.MaxCount) && (count < pageSize))); readerRead = reader.Read()) { readCount = (readCount + 1); if ((CodeFluent.Runtime.CodeFluentPersistence.CanAddEntity(pageIndex, pageSize, pageOptions, readCount) == true)) { SoftFluent.Samples.AspNetIdentity2.User user = new SoftFluent.Samples.AspNetIdentity2.User(); ((CodeFluent.Runtime.ICodeFluentEntity)(user)).ReadRecord(reader); if ((this.BaseContains(user) == false)) { this.BaseAdd(user); count = (count + 1); } user.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; } } if ((role != null)) { role.EntityState = roleState; } }
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); }
protected internal void OnEntityDeserializing(System.Runtime.Serialization.StreamingContext context) { this.IsDeserializing = true; this._id = CodeFluentPersistence.DefaultGuidValue; this._firstName = default(string); this._lastName = default(string); this._raisePropertyChangedEvents = true; this._id = System.Guid.NewGuid(); this._entityState = CodeFluent.Runtime.CodeFluentEntityState.Created; this._raisePropertyChangedEvents = true; }
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.Samples.ComponentOne.Constants.SoftFluent_Samples_ComponentOneStoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "User", "Save"); persistence.AddParameter("@User_Id", this.Id, CodeFluentPersistence.DefaultGuidValue); persistence.AddParameter("@User_Email", this.Email, default(string)); persistence.AddParameter("@User_FirstName", this.FirstName, default(string)); persistence.AddParameter("@User_LastName", this.LastName, default(string)); persistence.AddParameter("@_trackLastWriteUser", persistence.Context.User.Name); persistence.AddParameter("@_rowVersion", this.RowVersion); if ((this._photo != null)) { this._photo.SaveMetaData(persistence.Context); } 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); }
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); }
protected internal void OnEntityDeserializing(System.Runtime.Serialization.StreamingContext context) { this.IsDeserializing = true; this._id = -1; this._email = default(string); this._firstName = default(string); this._lastName = default(string); this._fullName = default(string); this._contacts = default(MyCie.ContactManager.ContactCollection); this._raisePropertyChangedEvents = true; this._entityState = CodeFluent.Runtime.CodeFluentEntityState.Created; this._raisePropertyChangedEvents = true; }
protected internal void OnEntityDeserializing(System.Runtime.Serialization.StreamingContext context) { this.IsDeserializing = true; this._raisePropertyChangedEvents = true; this._id = -1; this._email = default(string); this._firstName = default(string); this._lastName = default(string); this._fullName = default(string); this._photo = default(CodeFluent.Runtime.BinaryServices.BinaryLargeObject); this._entityState = CodeFluent.Runtime.CodeFluentEntityState.Created; this._raisePropertyChangedEvents = true; }
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, "StockItem", "Save"); persistence.AddParameter("@StockItem_Id", this.Id, ((int)(-1))); persistence.AddParameter("@StockItem_Publication_Id", this.PublicationId, ((int)(-1))); persistence.AddParameter("@StockItem_Space_Id", this.SpaceId, ((int)(-1))); persistence.AddParameter("@StockItem_Quantity", this.Quantity, CodeFluentPersistence.DefaultInt32Value); persistence.AddParameter("@StockItem_AvailableQuantity", this.AvailableQuantity, CodeFluentPersistence.DefaultInt32Value); 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); }
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.SqlServerInMemory.Constants.SoftFluent_SqlServerInMemoryStoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "Customer", "Save"); persistence.AddParameter("@Customer_Id", this.Id, CodeFluentPersistence.DefaultGuidValue); persistence.AddParameter("@Customer_Name", this.Name, default(string)); persistence.AddParameter("@Customer_ContactSource_Id", this.ContactSourceId, ((int)(-1))); persistence.AddParameter("@_trackLastWriteUser", persistence.Context.User.Name); 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); }
protected internal void OnEntityDeserializing(System.Runtime.Serialization.StreamingContext context) { this.IsDeserializing = true; this._id = -1; this._line1 = default(string); this._line2 = default(string); this._city = default(string); this._zip = default(string); this._country = default(string); this._contact = default(MyCie.ContactManager.Contact); this._googleMapUrl = default(string); this._liveMapUrl = default(string); this._raisePropertyChangedEvents = true; this._entityState = CodeFluent.Runtime.CodeFluentEntityState.Created; this._raisePropertyChangedEvents = true; }
protected internal void OnEntityDeserializing(System.Runtime.Serialization.StreamingContext context) { this.IsDeserializing = true; this._id = -1; this._email = default(string); this._firstName = default(string); this._lastName = default(string); this._contactSource = default(MyCie.ContactManager.ContactSource); this._status = default(MyCie.ContactManager.Status); this._address = default(MyCie.ContactManager.Address); this._user = default(MyCie.ContactManager.User); this._description = default(string); this._raisePropertyChangedEvents = true; this._entityState = CodeFluent.Runtime.CodeFluentEntityState.Created; this._raisePropertyChangedEvents = true; }
public virtual bool Reload(CodeFluent.Runtime.CodeFluentReloadOptions options) { bool ret = false; if (((this.RoleId.Equals(CodeFluentPersistence.DefaultGuidValue) == true) || (this.UserId.Equals(CodeFluentPersistence.DefaultGuidValue) == true))) { return(ret); } CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.GED.Constants.SoftFluent_Samples_GEDStoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "UserRole", "Load"); persistence.AddParameter("@RoleId", this.RoleId, CodeFluentPersistence.DefaultGuidValue); persistence.AddParameter("@UserId", this.UserId, CodeFluentPersistence.DefaultGuidValue); System.Data.IDataReader reader = null; try { reader = persistence.ExecuteReader(); if ((reader.Read() == true)) { this.ReadRecord(reader, options); this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; ret = true; } else { this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Deleted; } } finally { if ((reader != null)) { reader.Dispose(); } persistence.CompleteCommand(); } return(ret); }
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); } CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.SqlServerInMemory.Constants.SoftFluent_SqlServerInMemoryStoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "Customer", "Delete"); persistence.AddParameter("@Customer_Id", this.Id, CodeFluentPersistence.DefaultGuidValue); 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 virtual bool Reload(CodeFluent.Runtime.CodeFluentReloadOptions options) { bool ret = false; if ((this.Id.Equals(CodeFluentPersistence.DefaultGuidValue) == true)) { return(ret); } CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.RedisCache.Constants.SoftFluent_Samples_RedisCacheStoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "Category", "Load"); persistence.AddParameter("@Id", this.Id); persistence.AddParameter("@Lcid", System.Threading.Thread.CurrentThread.CurrentUICulture.LCID, ((int)(1033))); System.Data.IDataReader reader = null; try { reader = persistence.ExecuteReader(); if ((reader.Read() == true)) { this.ReadRecord(reader, options); this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; ret = true; } else { this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Deleted; } } finally { if ((reader != null)) { reader.Dispose(); } persistence.CompleteCommand(); } return(ret); }
public virtual bool Reload(CodeFluent.Runtime.CodeFluentReloadOptions options) { bool ret = false; if ((this.Id.Equals(CodeFluentPersistence.DefaultGuidValue) == true)) { return(ret); } CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.EncryptAspect.Constants.SoftFluent_Samples_EncryptAspectStoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "Customer", "Load"); persistence.AddParameter("@Id", this.Id); persistence.AddParameter("@PassPhrase", SoftFluent.Samples.EncryptAspect.PassPhrase.GetPassPhrase(), default(string)); System.Data.IDataReader reader = null; try { reader = persistence.ExecuteReader(); if ((reader.Read() == true)) { this.ReadRecord(reader, options); this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; ret = true; } else { this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Deleted; } } finally { if ((reader != null)) { reader.Dispose(); } persistence.CompleteCommand(); } return(ret); }
public virtual bool Reload(CodeFluent.Runtime.CodeFluentReloadOptions options) { bool ret = false; if ((this.Id == -1)) { return(ret); } CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Json.NET.Constants.SoftFluent_Json_NETStoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "Publication", "Load"); persistence.AddParameter("@Id", this.Id, ((int)(-1))); System.Data.IDataReader reader = null; try { reader = persistence.ExecuteReader(); if ((reader.Read() == true)) { this.ReadRecord(reader, options); this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; ret = true; } else { this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Deleted; } } finally { if ((reader != null)) { reader.Dispose(); } persistence.CompleteCommand(); } return(ret); }
public virtual bool Reload(CodeFluent.Runtime.CodeFluentReloadOptions options) { bool ret = false; if ((this.ProviderKey == default(string))) { return(ret); } CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(SoftFluent.Samples.AspNetIdentity1.Constants.SoftFluent_Samples_AspNetIdentity1StoreName).Persistence; persistence.CreateStoredProcedureCommand(null, "ExternalLogin", "Load"); persistence.AddParameter("@ProviderKey", this.ProviderKey); System.Data.IDataReader reader = null; try { reader = persistence.ExecuteReader(); if ((reader.Read() == true)) { this.ReadRecord(reader, options); this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Unchanged; ret = true; } else { this.EntityState = CodeFluent.Runtime.CodeFluentEntityState.Deleted; } } finally { if ((reader != null)) { reader.Dispose(); } persistence.CompleteCommand(); } return(ret); }
public Customer() { this._id = System.Guid.NewGuid(); this._entityState = CodeFluent.Runtime.CodeFluentEntityState.Created; }