//[Test] public void SelectArtistFullWithLazyLoadingTitles() { using (var db = new MusicDB()) { var query2 = new FullSqlQueryT<Artist2>(db); var artist = query2.SelectByKey(2643); var titles = artist.Titles; } }
//[Test] public void SelectAllTitlesFull2() { using (var db = new MusicDB()) { var query2 = new FullSqlQuery(db); var titles = query2.SelectAll<Title>(); var title = (Title) query2.SelectByKey(typeof (Title), 137653); } }
//[Test] public void SelectAllTitlesFull() { using (var db = new MusicDB()) { var query = new FullSqlQueryT <Title>(db); var titles1 = query.SelectAll <List <Title> >(); List <Title> titles2 = query.SelectAll(); } }
//[Test] public void SelectAllTitlesFull2() { using (var db = new MusicDB()) { var query2 = new FullSqlQuery(db); var titles = query2.SelectAll <Title>(); var title = (Title)query2.SelectByKey(typeof(Title), 137653); } }
//[Test] public void SelectArtistFullWithLazyLoadingTitles() { using (var db = new MusicDB()) { var query2 = new FullSqlQueryT <Artist2>(db); var artist = query2.SelectByKey(2643); var titles = artist.Titles; } }
//[Test] public void SelectAllTitlesFull() { using (var db = new MusicDB()) { var query = new FullSqlQueryT<Title>(db); var titles1 = query.SelectAll<List<Title>>(); List<Title> titles2 = query.SelectAll(); } }
//[Test] public void SelectTitleFull() { using (var db = new MusicDB()) { var query2 = new FullSqlQueryT <Title>(db); var title = query2.SelectByKey(137653); var titleName = title.Name; } }
//[Test] public void SelectAllArtistsIgnoreLazyLoading() { using (var db = new MusicDB()) { var query2 = new FullSqlQuery(db, true); //loading is automatic var artist2 = (Artist2) query2.SelectByKey(typeof (Artist2), 2643); var titles2 = artist2.Titles; var query = new FullSqlQuery(db); // Dont ignore lazyloading var artist = (Artist2) query.SelectByKey(typeof (Artist2), 2643); var titles = artist.Titles; Assert.AreEqual(titles2.Count, titles.Count); } }
//[Test] public void SelectAllArtistsIgnoreLazyLoading() { using (var db = new MusicDB()) { var query2 = new FullSqlQuery(db, true); //loading is automatic var artist2 = (Artist2)query2.SelectByKey(typeof(Artist2), 2643); var titles2 = artist2.Titles; var query = new FullSqlQuery(db); // Dont ignore lazyloading var artist = (Artist2)query.SelectByKey(typeof(Artist2), 2643); var titles = artist.Titles; Assert.AreEqual(titles2.Count, titles.Count); } }
//[Test] public void SelectAllArtistsLazyLoading() { using (var db = new MusicDB()) { var dbCmd = db.SetCommand("SELECT ID_ARTIST FROM PITAFR01.Artist where date_creation > sysdate - 200"); dbCmd.MappingSchema = new FullMappingSchema(); var art = dbCmd.ExecuteList <Artist2>(); var titles = art[0].Titles; var query2 = new FullSqlQueryT <Artist2>(db); var artists = query2.SelectAll(); var artist2 = artists[0]; var titles2 = artist2.Titles; } }
//[Test] public void SelectAllArtistsLazyLoading() { using (var db = new MusicDB()) { DbManager dbCmd = db.SetCommand("SELECT ID_ARTIST FROM PITAFR01.Artist where date_creation > sysdate - 200"); dbCmd.MappingSchema = new FullMappingSchema(); List<Artist2> art = dbCmd.ExecuteList<Artist2>(); List<Title> titles = art[0].Titles; var query2 = new FullSqlQueryT<Artist2>(db); List<Artist2> artists = query2.SelectAll(); Artist2 artist2 = artists[0]; List<Title> titles2 = artist2.Titles; } }
public void SelectAllArtistsIgnoreLazyLoading() { using (var db = new MusicDB()) { var queryI = from a in db.GetTable<Artist>() where a.Id == 2471 select a; var aaa = queryI.First(); aaa.Name = "JE NE SUIS PAS UN HÉROS"; var data = new byte[] {0x4A, 0x45, 0x20, 0x4E, 0x45, 0x20, 0x53, 0x55, 0x49, 0x53, 0x20, 0x50, 0x41, 0x53, 0x20, 0x55, 0x4E, 0x20, 0x48, 0xC3, 0x83, 0xC2, 0x89, 0x52, 0x4F, 0x53}; aaa.Name = Encoding.UTF8.GetString(data); var updateQuery = new SqlQuery(db); updateQuery.Update(aaa); var ccc = aaa.Id; var query2 = new FullSqlQuery(db, true); //loading is automatic var artist2 = (Artist2) query2.SelectByKey(typeof (Artist2), 2643); List<Title> titles2 = artist2.Titles; var query = new FullSqlQuery(db); var artist = (Artist2) query.SelectByKey(typeof (Artist2), 2643); List<Title> titles = artist.Titles; Assert.AreEqual(titles2.Count, titles.Count); } }
public void SelectAllArtistsLazyLoading() { using (var db = new MusicDB()) { DbManager dbCmd = db.SetCommand("SELECT ID_ARTIST FROM PITAFR01.Artist where date_creation > sysdate - 200"); dbCmd.MappingSchema = new FullMappingSchema(); // ExecuteList works only with LazyLoadingTrue List<Artist2> art = dbCmd.ExecuteList<Artist2>(); foreach (Artist2 artist in art) { List<Title> titles = artist.Titles; Console.WriteLine(titles.Count); break; } } }
public void SelectAllTitlesFullQueryAssociation() { using (var db = new MusicDB()) { var query = new FullSqlQueryT<Title>(db); List<Title> titles2 = query.SelectAll(); Assert.IsTrue(titles2.Count > 0); } }
public void SelectArtistWithTitlesLazyLoadingOnQueryAssociation() { using (var db = new MusicDB()) { var query2 = new FullSqlQueryT<Artist2>(db); Artist2 artist = query2.SelectByKey(2643); List<Title> titles = artist.Titles; Console.WriteLine(titles.Count); } }
//[Test] public void SelectTitleFull() { using (var db = new MusicDB()) { var query2 = new FullSqlQueryT<Title>(db); var title = query2.SelectByKey(137653); var titleName = title.Name; } }
public void SelectTest1() { string sql = File.ReadAllText(@"c:\requeteOrqua.txt"); var forms = new List<FILE_FORM>(); using (var db = new MusicDB()) { //var query = from f in using (var a = new ExecTimeInfo()) { //db.SetCommand(sql); //var reader = db.ExecuteReader(); //var schemaTable = reader.GetSchemaTable(); //while (reader.Read()) //{ // //var values = new object[schemaTable.Columns.Count]; // //reader.GetValues(values); // reader.GetValue(0); //} DbManager dbCmd = db.SetCommand(sql); dbCmd.MappingSchema = new FullMappingSchema(inheritedMappingSchema: dbCmd.MappingSchema, mappingOrder: MappingOrder.ByColumnName, ignoreMissingColumns: true, ignoreLazyLoad: false); var allMedia = dbCmd.ExecuteList<FILE_FORM>(); forms = allMedia; foreach (FILE_FORM fileForm in allMedia) { if (fileForm.SCRIPT_FIELD != null && !fileForm.SCRIPT_FIELD.IsNull) { //string clobValue = fileForm.SCRIPT_FIELD.Value; } } } } }
public void SelectTitleWithArtistQueryAssociation() { using (var db = new MusicDB()) { var query = new FullSqlQuery(db); var title = (Title) query.SelectByKey(typeof (Title), 137653); Console.WriteLine(title.Name); var query2 = new FullSqlQueryT<Title>(db); var title2 = query2.SelectByKey(137653); Console.WriteLine(title2.Name); } }
private static void GetMediaReq(string req) { using (var db = new MusicDB()) { using (var a = new ExecTimeInfo()) { db.SetCommand(req); var allMedia = db.ExecuteList<Media>(); } using (var a = new ExecTimeInfo()) { db.SetCommand(req); var allMedia = db.ExecuteList<Media>(); } } }
private static void GetMediaLinq() { var all = new List<long> {21, 24, 25, 27, 38, 221}; using (var db = new MusicDB()) { using (var a = new ExecTimeInfo()) { var query = from m in db.GetTable<Media>() join basicMedia in db.GetTable<BasicMedia>() on m.ID_BASIC_MEDIA equals basicMedia.ID_BASIC_MEDIA where m.ACTIVATION == 0 && basicMedia.ACTIVATION == 0 && all.Contains(basicMedia.ID_CATEGORY) select m; var allMedia = query.ToList(); } using (var a = new ExecTimeInfo()) { var query = from m in db.GetTable<Media>() join basicMedia in db.GetTable<BasicMedia>() on m.ID_BASIC_MEDIA equals basicMedia.ID_BASIC_MEDIA where m.ACTIVATION == 0 && basicMedia.ACTIVATION == 0 && all.Contains(basicMedia.ID_CATEGORY) select m; var allMedia = query.ToList(); } using (var a = new ExecTimeInfo()) { var query = from basicMedia in db.GetTable<BasicMedia>() where basicMedia.ACTIVATION == 0 select basicMedia; var allMedia = query.ToList(); } using (var a = new ExecTimeInfo()) { var query = from basicMedia in db.GetTable<BasicMedia>() where basicMedia.ACTIVATION == 0 select basicMedia; var allMedia = query.ToList(); } } }
public void TestSelection() { var beginSpotPeriod = new DateTime(2012, 09, 03); using (var pitagorDb = new MusicDB()) { pitagorDb.UseQueryText = true; var dbQuery = from dr in pitagorDb.GetTable<DATA_RADIO>() join dv in pitagorDb.GetTable<DATA_VERSION>() on dr.ID_DATA_VERSION equals dv.ID_DATA_VERSION where dr.DATE_MEDIA == beginSpotPeriod select new DataEntryBroadcast { Id = dr.ID_DATA_VERSION, VersionId = dv.ID_MULTIMEDIA, DateMedia = dr.DATE_MEDIA, MediaId = dr.ID_MEDIA, SpotBegin = dr.DATE_SPOT_BEGINNING, SpotEnd = dr.DATE_SPOT_END, }; dbQuery = dbQuery.Where(e => e.MediaId == 2015); var res = dbQuery.ToList(); Assert.IsNotEmpty(res); } }