コード例 #1
0
        public static AssemblyDescriptorCollection Where(WhereDelegate <AssemblyDescriptorColumns> where, OrderBy <AssemblyDescriptorColumns> orderBy = null, Database database = null)
        {
            database = database ?? Db.For <AssemblyDescriptor>();
            var results = new AssemblyDescriptorCollection(database, database.GetQuery <AssemblyDescriptorColumns, AssemblyDescriptor>(where, orderBy), true);

            return(results);
        }
コード例 #2
0
        /// <summary>
        /// Return every record in the AssemblyDescriptor table.
        /// </summary>
        /// <param name="database">
        /// The database to load from or null
        /// </param>
        public static AssemblyDescriptorCollection LoadAll(Database database = null)
        {
            SqlStringBuilder sql = new SqlStringBuilder();

            sql.Select <AssemblyDescriptor>();
            Database db      = database ?? Db.For <AssemblyDescriptor>();
            var      results = new AssemblyDescriptorCollection(db, sql.GetDataTable(db));

            results.Database = db;
            return(results);
        }
コード例 #3
0
        private static AssemblyDescriptor OneOrThrow(AssemblyDescriptorCollection c)
        {
            if (c.Count == 1)
            {
                return(c[0]);
            }
            else if (c.Count > 1)
            {
                throw new MultipleEntriesFoundException();
            }

            return(null);
        }
コード例 #4
0
        public void SaveDescriptorDoesntDuplicate()
        {
            AssemblyServiceRepository repo = GetTestRepo(nameof(SaveDescriptorDoesntDuplicate));

            AssemblyDescriptor descriptor = new AssemblyDescriptor(Assembly.GetExecutingAssembly());

            AssemblyDescriptor one = repo.Save(descriptor);
            AssemblyDescriptor two = repo.Save(descriptor);

            Expect.IsNotNull(one, "first save returned null");
            Expect.IsNotNull(two, "second save returned null");
            Expect.AreEqual(one.Id, two.Id, "Ids didn't match");
            Expect.AreEqual(one.Uuid, two.Uuid, "Uuids didn't match");

            Dao.AssemblyDescriptorCollection descriptors = Dao.AssemblyDescriptor
                                                           .Where(q =>
                                                                  q.AssemblyFullName == descriptor.AssemblyFullName &&
                                                                  q.FileHash == descriptor.FileHash &&
                                                                  q.Name == descriptor.Name, repo.Database);

            Expect.AreEqual(1, descriptors.Count);
        }
コード例 #5
0
        /// <summary>
        /// This method is intended to respond to client side Qi queries.
        /// Use of this method from .Net should be avoided in favor of
        /// one of the methods that take a delegate of type
        /// WhereDelegate&lt;AssemblyDescriptorColumns&gt;.
        /// </summary>
        /// <param name="where"></param>
        /// <param name="database"></param>
        public static AssemblyDescriptorCollection Where(QiQuery where, Database database = null)
        {
            var results = new AssemblyDescriptorCollection(database, Select <AssemblyDescriptorColumns> .From <AssemblyDescriptor>().Where(where, database));

            return(results);
        }