// Lecture de la clef primaire public static string GetTableOrViewName(Type objectType) { string name = DataObject.GetViewName(objectType); // if not a view, we use tablename, else viewname if (string.IsNullOrEmpty(name)) { return(DataObject.GetTableName(objectType)); } return(name); }
/// <summary> /// Primary Key ID of a view /// </summary> /// <param name="objectType"></param> /// <returns></returns> public static string GetTableOrViewName(Type objectType) { // Graveen: introducing view selection hack (before rewriting the layer :D) // basically, a view must exist and is created with the following: // // [DataTable(TableName="InventoryItem",ViewName = "MarketItem")] // public class SomeMarketItems : InventoryItem {}; // // here, we rely on the view called MarketItem, // based on the InventoryItem table. We have to tell to the code // only to bypass the id generated with FROM by the above // code. // string name = DataObject.GetViewName(objectType); // if not a view, we use tablename, else viewname if (string.IsNullOrEmpty(name)) { return(DataObject.GetTableName(objectType)); } return(name); }