Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

c# - Best way to dynamically get column names from oracle tables -


we using extractor application export data database csv files. based on condition variable extracts data different tables, , conditions have use union data has extracted more 1 table. satisfy union condition using nulls match number of columns.

right queries in system pre-built based on condition variable. problem whenever there change in table projection (i.e new column added, existing column modified, column dropped) have manually change code in application.

can please give suggestions how extract column names dynamically changes in table structure not require change in code?


my concern condition decides table query. variable condition

  • if condition a, load tablex
  • if condition b load tablea , tabley.

we must know table need data. once know table straightforward query column names data dictionary. there 1 more condition, columns need excluded, , these columns different each table.

i trying solve problem dynamically generating list columns. manager told me make solution on conceptual level rather fixing. big system providers , consumers loading , consuming data. wanted solution can general.

so best way storing condition, tablename, excluded columns? 1 way storing in database. there other ways? if yes best? have give @ least couple of ideas before finalizing.

thanks,

ok, mnc, try size (paste new console app):

using system; using system.collections.generic; using system.linq; using test.api; using test.api.classes; using test.api.interfaces; using test.api.models;  namespace test.api.interfaces {     public interface itable     {         int id { get; set; }         string name { get; set; }     } }  namespace test.api.models {     public class membertable : itable     {         public int id { get; set; }         public string name { get; set; }     }     public class tablewithrelations     {         public membertable member { get; set; }         // list contain partnered tables         public ilist<itable> partner { get; set; }          public tablewithrelations()         {             member = new membertable();             partner = new list<itable>();         }     } }  namespace test.api.classes {     public class myclass     {         private readonly ilist<tablewithrelations> _tables;          public myclass()         {             // tablea stuff             var tablea = new tablewithrelations { member = { id = 1, name = "a" } };             var relatedclasses = new list<itable>              {                 new membertable                 {                    id = 2,                    name = "b"                 }              };             tablea.partner = relatedclasses;               // tableb stuff             var tableb = new tablewithrelations { member = { id = 2, name = "b" } };             relatedclasses = new list<itable>              {                 new membertable                 {                    id = 3,                    name = "c"                 }              };             tableb.partner = relatedclasses;               // tablec stuff             var tablec = new tablewithrelations { member = { id = 3, name = "c" } };             relatedclasses = new list<itable>              {                 new membertable                 {                    id = 2,                    name = "d"                 }              };             tablec.partner = relatedclasses;               // tabled stuff             var tabled = new tablewithrelations { member = { id = 3, name = "d" } };             relatedclasses = new list<itable>              {                 new membertable                 {                    id = 1,                    name = "a"                 },                 new membertable                 {                    id = 2,                    name = "b"                 },              };             tabled.partner = relatedclasses;              // add tables base tables collection             _tables = new list<tablewithrelations> { tablea, tableb, tablec, tabled };         }          public ilist<itable> compare(int tableid, string tablename)         {             return _tables.where(table => table.member.id == tableid                             && table.member.name == tablename)                         .selectmany(table => table.partner).tolist();         }     } }  namespace test.api {     public class testclass     {         private readonly myclass _myclass;         private readonly ilist<itable> _relatedmembers;          public ilist<itable> relatedmembers         {             { return _relatedmembers; }         }          public testclass(int id, string name)         {             this._myclass = new myclass();             // compare method take 2 paramters , return             // mathcing set of related tables formed related tables             _relatedmembers = _myclass.compare(id, name);             // wityh resulting list         }     } }  class program {     static void main(string[] args)     {         // change these values suit, along rules in myclass         var id = 3;         var name = "d";         var testclass = new testclass(id, name);          console.write(string.format("for table{0} on id{1}\r\n", name, id));         console.write("----------------------\r\n");         foreach (var relatedtable in testclass.relatedmembers)         {             console.write(string.format("related table{0} on id{1}\r\n",                       relatedtable.name, relatedtable.id));         }         console.read();     } } 

i'll in bit see if fits or not.


Comments

Popular posts from this blog

c# - Usage of Server Side Controls in MVC Frame work -

cocoa - Nesting arrays into NSDictionary object (Objective-C) -

ios - Very simple iPhone App crashes on UILabel settext -