Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to change LINQ table name/source during runtime?
Message
From
19/04/2010 18:07:33
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
19/04/2010 06:54:28
Fener Yok
Pen Software
Turkey
General information
Forum:
ASP.NET
Category:
LINQ
Miscellaneous
Thread ID:
01460880
Message ID:
01461004
Views:
54
>I've got a database, and an entityset created by the O/R-Mapper, using all this with LINQ.
>
>In the O/R-Mapper I need to enter a table name (source) for every table, which is being used for the SQL generated by LINQ. In the .dbml file it looks like this:
>
>
>  < Table Name="dbo.TBL_001_INVOICE" Member="INVOICE">
>
>or
>
>
>[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.TBL_001_INVOICE")]
>public partial class CLASS_LINQ_INVOICE : INotifyPropertyChanging, INotifyPropertyChanged
>
>in this case "001" is a firm number.
>
>Now I'd like to change this table name during runtime, so the SQL will be run against some other table (i want to change firm number in runtime so when i changed firm number in runtime table names should be updated).
>
>Is there any way to change the table name (source name) during runtime?

You can use XmlMappingSource. DataContext has a constructor ( connection(string or IDbConection), MappingSource).

"Fener Yok" ne demek? "Yen yaz 1907'ye yolla Fener gelsin evinde yensin:)" ile ilgili mi? Gerdi nerede?

PS: Wouldn't you instead think of using L2E.

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform