use*_*041 10 .net c# mysql database persistence
是否有任何内置于.Net或visual studio中的内容可以让我根据MySql表创建类.我想我在谈论持久性.我只想让类成为表的1对1映射.有什么免费的吗?
Mee*_*orm 20
也许你需要这样的东西:
select 'my_table' into @table; #table name
select 'my_database' into @schema; #database name
select concat('public class ',@table,'{') union
select concat('public ',tps.dest,' ',column_name,'{get;set;}') from information_schema.columns c
join( #datatypes mapping
select 'char' as orign ,'string' as dest union all
select 'varchar' ,'string' union all
select 'longtext' ,'string' union all
select 'datetime' ,'DateTime?' union all
select 'text' ,'string' union all
select 'bit' ,'int?' union all
select 'bigint' ,'int?' union all
select 'int' ,'int?' union all
select 'double' ,'double?' union all
select 'decimal' ,'double?' union all
select 'date' ,'DateTime?' union all
select 'tinyint' ,'bool?'
) tps on c.data_type like tps.orign
where table_schema=@schema and table_name=@table union
select '}';
Run Code Online (Sandbox Code Playgroud)
似乎有一种方法可以让 EntityFramework 与 MySQL 一起使用
归档时间: |
|
查看次数: |
16807 次 |
最近记录: |