Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void GetListOfTables()
- {
- try
- {
- using (var dbContext = new CustomerRelationshipIndexEntities())
- {
- var metadata = ((IObjectContextAdapter)dbContext).ObjectContext.MetadataWorkspace;
- var tables = metadata.GetItemCollection(DataSpace.SSpace)
- .GetItems<EntityContainer>()
- .Single()
- .BaseEntitySets
- .OfType<EntitySet>()
- .Where(s => !s.MetadataProperties.Contains("Type")
- || s.MetadataProperties["Type"].ToString() == "Tables");
- foreach (var table in tables)
- {
- // I need to read the column names of the current table
- }
- }
- }
- catch (Exception ex)
- {
- string errormessage = el.CreateErrorMessage(ex);
- el.LogFileWrite(errormessage);
- }
- }
- var names = typeof(AllowedUser).GetProperties()
- .Select(property => property.Name)
- .ToArray();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement