New Posts New Posts RSS Feed: Tables created on the fly
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Tables created on the fly

 Post Reply Post Reply
Author
BillG View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 05-Dec-2007
Location: Monroe, MI
Posts: 233
Post Options Post Options   Quote BillG Quote  Post ReplyReply Direct Link To This Post Topic: Tables created on the fly
    Posted: 04-Dec-2013 at 5:53am
I know that my DevForce entity model needs to know my tables ahead of time to take a snapshot. But how do I handle this situation. I have a base table named PercapHist. Each month a new table is created in a stored procedure. (ex PercapOEDues1301, PercapOEDues1302 etc.)

In a certain routine I need to know if the percap routine was run for a previous month or already run for the current month. such as the following

string thisMonth = (percapMonth.Year + percapMonth.Month).ToString();
string percapThisMonth = "PercapOEDues" + thisMonth;

DateTime lastPercap = percapMonth.AddMonths(-1);
string lastMonth = (lastPercap.Year + percapMonth.Month).ToString();
string percapLastMonth = "PercapOEDues" + lastMonth;

Now I need to query either of the two tables PercapThisMonth or PercapLastMonth and see if they have any rows in them.



Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 04-Dec-2013 at 8:47am
The mapping to the storage layer, which is done by EF not DevForce, is static and can't be changed at runtime.   You're best bet here is probably a stored proc query or view.
Back to Top
smi-mark View Drop Down
DevForce MVP
DevForce MVP
Avatar

Joined: 24-Feb-2009
Location: Dallas, Texas
Posts: 343
Post Options Post Options   Quote smi-mark Quote  Post ReplyReply Direct Link To This Post Posted: 04-Dec-2013 at 8:48am
Can you have a stored procedure that will return the data based on the year/month you pass to it, and then map the stored procedure to return your PercapHist entity?
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down