コード例 #1
0
 public static SoftFluent.SqlServerInMemory.CustomerCollection PageLoadByContactSource(int pageIndex, int pageSize, int contactSourceId)
 {
     SoftFluent.SqlServerInMemory.ContactSource contactSource = SoftFluent.SqlServerInMemory.ContactSource.Load(contactSourceId);
     if ((contactSource == null))
     {
         return(new SoftFluent.SqlServerInMemory.CustomerCollection());
     }
     return(SoftFluent.SqlServerInMemory.CustomerCollection.PageLoadByContactSource(pageIndex, pageSize, null, contactSource));
 }
コード例 #2
0
        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;
            }
        }
コード例 #3
0
 public static System.Data.IDataReader DataLoadByContactSource(SoftFluent.SqlServerInMemory.ContactSource contactSource)
 {
     System.Data.IDataReader reader = SoftFluent.SqlServerInMemory.CustomerCollection.PageDataLoadByContactSource(null, contactSource);
     return(reader);
 }
コード例 #4
0
 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);
 }
コード例 #5
0
 public static SoftFluent.SqlServerInMemory.CustomerCollection LoadByContactSource(SoftFluent.SqlServerInMemory.ContactSource contactSource)
 {
     SoftFluent.SqlServerInMemory.CustomerCollection ret = SoftFluent.SqlServerInMemory.CustomerCollection.PageLoadByContactSource(int.MinValue, int.MaxValue, null, contactSource);
     return(ret);
 }
コード例 #6
0
 public static SoftFluent.SqlServerInMemory.CustomerCollection PageLoadByContactSource(int pageIndex, int pageSize, CodeFluent.Runtime.PageOptions pageOptions, SoftFluent.SqlServerInMemory.ContactSource contactSource)
 {
     if ((pageIndex < 0))
     {
         pageIndex = 0;
     }
     if ((pageSize < 0))
     {
         if ((pageOptions != null))
         {
             pageSize = pageOptions.DefaultPageSize;
         }
         else
         {
             pageSize = int.MaxValue;
         }
     }
     SoftFluent.SqlServerInMemory.CustomerCollection ret = new SoftFluent.SqlServerInMemory.CustomerCollection();
     System.Data.IDataReader reader = null;
     try
     {
         reader = SoftFluent.SqlServerInMemory.CustomerCollection.PageDataLoadByContactSource(pageOptions, contactSource);
         if ((reader == null))
         {
             return(ret);
         }
         ret.LoadByContactSource(pageIndex, pageSize, pageOptions, reader, contactSource);
     }
     finally
     {
         if ((reader != null))
         {
             reader.Dispose();
         }
         CodeFluent.Runtime.CodeFluentPersistence.CompleteCommand(SoftFluent.SqlServerInMemory.Constants.SoftFluent_SqlServerInMemoryStoreName);
     }
     return(ret);
 }
コード例 #7
0
 public CustomerCollection(SoftFluent.SqlServerInMemory.ContactSource unspecifiedContactSourceContactSource)
 {
     this._blm227059945 = new CodeFluent.Runtime.Utilities.BindingListManager <SoftFluent.SqlServerInMemory.Customer>(this);
     this._unspecifiedContactSourceContactSource = unspecifiedContactSourceContactSource;
 }