开发者

How to read a DBML file and map it into an object model in .NET?

开发者 https://www.devze.com 2022-12-10 23:08 出处:网络
I\'m planning to write a code generator to generate UI (forms, grids, etc.). Since I\'m using LINQ I\'m planning to read a DBML file for metadata extraction purposes. Is there some API to read the DBM

I'm planning to write a code generator to generate UI (forms, grids, etc.). Since I'm using LINQ I'm planning to read a DBML file for metadata extraction purposes. Is there some API to read the DBML object model (database, tables, columns, and associations)?

I've opened SQLMetal.exe with Red Gate Software's .NET Reflector. It contains a namespace called LinqToSqlShared.DbmlObjectModel and it seems it contains everything I need to read a DBML object model. The bad news is: that namespace is not exposed for external consumption and all classe开发者_JAVA百科s are declared as "Friend" (or sealed).

Once again, does something exist, like the LinqToSqlShared.DbmlObjectModel namespace, to read DBML to an object model in .NET.? Or do I have to write it my self?


Have a look at how the model is read in L2ST4 project. You could reuse the T4 file.


Take a look at a tool like Reegenerator. We're considering this as a replacement for the L2S code generator, because we've got some specific code generation requirements.

0

精彩评论

暂无评论...
验证码 换一张
取 消