Open GoogleCodeExporter opened 9 years ago
Hello,
We provide a public static field on the generated DataContext called
MappingCache. If you created a map file using a custom template
(http://community.codesmithtools.com/CodeSmith_Community/b/blake/archive/2011/01
/19/extending-the-codesmith-generator-plinqo-templates.aspx) or SQLMetal, you
could set the MappingCache field on application startup (Global Application
Object or during application Init) using the steps from the blog. From this
point any call using the generated DataContext would use the mapping file.
Does this solution work for you? Also the generated DataContext has a
OnCreated() partial method that you could possibly hook into, but I think it
would be better to do this during application launch.
Thanks
-Blake Niemyjski
Original comment by bniemyjski
on 18 May 2011 at 7:01
Blake,
Thanks for your reply. I think the biggest roadblock is that I can't predict
the table prefix or database owner. It can vary with every DNN installation.
It's not feasible to generate a new mapping file for each customer's
environment. I think the only solution is to be able to set the table name at
runtime (which isn't natively supported by LINQ-to-SQL).
I found a "Model Adapter" for L2S that may solve the issue, but the project is
not being actively developed: http://dnnlinqtosqladapter.codeplex.com/ I also
saw a model adapter for Entity Framework that has some nice features:
http://efmodeladapter.codeplex.com/
I'm hoping one (or both) of these will be of interest to CodeSmith as potential
enhancements to PLINQO. It would solve problems in a number of environments
and use cases.
Thanks again for your consideration!
-Kevin
Original comment by KevinLa...@gmail.com
on 18 May 2011 at 8:33
Hello,
Thanks for your feedback. It looks like both of those projects haven't been
updated in quite a while. I'll bring this up to the team during our next scrum
meeting and see what the team thinks.
Thanks
-Blake Niemyjski
Original comment by bniemyjski
on 19 May 2011 at 4:03
Hello,
We talked this over as a team and are considering adding this to a future
version of PLINQO (Depending on number of requests). This behavior can already
be safely added to the generated solution following the tutorials above while
retaining active generation support.
Please let us know if you have any questions or concerns
Thanks
-Blake Niemyjski
Original comment by bniemyjski
on 20 May 2011 at 4:54
Original issue reported on code.google.com by
KevinLa...@gmail.com
on 13 May 2011 at 6:01