public virtual LayoutFieldAttribute UpdateLayoutFieldAttribute(LayoutFieldAttribute entity)
        {
            if (entity.IsTransient())
            {
                return(entity);
            }
            LayoutFieldAttribute other = GetLayoutFieldAttribute(entity.LayoutFieldAttributeId);

            if (entity.Equals(other))
            {
                return(entity);
            }
            string sql = @"Update LayoutFieldAttribute set  [LayoutFieldAttributeGUID]=@LayoutFieldAttributeGUID
							, [LayoutID]=@LayoutID
							, [LayoutFieldID]=@LayoutFieldID
							, [Name]=@Name
							, [Value]=@Value 
							 where LayoutFieldAttributeID=@LayoutFieldAttributeID"                            ;

            SqlParameter[] parameterArray = new SqlParameter[] {
                new SqlParameter("@LayoutFieldAttributeID", entity.LayoutFieldAttributeId)
                , new SqlParameter("@LayoutFieldAttributeGUID", entity.LayoutFieldAttributeGuid)
                , new SqlParameter("@LayoutID", entity.LayoutId)
                , new SqlParameter("@LayoutFieldID", entity.LayoutFieldId)
                , new SqlParameter("@Name", entity.Name)
                , new SqlParameter("@Value", entity.Value)
            };
            SqlHelper.ExecuteNonQuery(this.ConnectionString, CommandType.Text, sql, parameterArray);
            return(GetLayoutFieldAttribute(entity.LayoutFieldAttributeId));
        }
        public virtual LayoutFieldAttribute InsertLayoutFieldAttribute(LayoutFieldAttribute entity)
        {
            LayoutFieldAttribute other = new LayoutFieldAttribute();

            other = entity;
            if (entity.IsTransient())
            {
                string         sql            = @"Insert into LayoutFieldAttribute ( [LayoutFieldAttributeGUID]
				,[LayoutID]
				,[LayoutFieldID]
				,[Name]
				,[Value] )
				Values
				( @LayoutFieldAttributeGUID
				, @LayoutID
				, @LayoutFieldID
				, @Name
				, @Value );
				Select scope_identity()"                ;
                SqlParameter[] parameterArray = new SqlParameter[] {
                    new SqlParameter("@LayoutFieldAttributeID", entity.LayoutFieldAttributeId)
                    , new SqlParameter("@LayoutFieldAttributeGUID", entity.LayoutFieldAttributeGuid)
                    , new SqlParameter("@LayoutID", entity.LayoutId)
                    , new SqlParameter("@LayoutFieldID", entity.LayoutFieldId)
                    , new SqlParameter("@Name", entity.Name)
                    , new SqlParameter("@Value", entity.Value)
                };
                var identity = SqlHelper.ExecuteScalar(this.ConnectionString, CommandType.Text, sql, parameterArray);
                if (identity == DBNull.Value)
                {
                    throw new DataException("Identity column was null as a result of the insert operation.");
                }
                return(GetLayoutFieldAttribute(Convert.ToInt32(identity)));
            }
            return(entity);
        }