【发布时间】:2018-07-03 08:07:40
【问题描述】:
我正在处理一项任务,我必须在单击按钮时使用现有数据源属性创建 mysql 表。下面是我的代码。
有什么帮助吗?
public BaseDto CreateTempTable(int dataSourceId, int profileId)
{
var dataSourceData = Unit.DataSourceRepository.Find(x => x.DataSourceId == dataSourceId).FirstOrDefault();
var profileData = Unit.ProfileSettingRepository.Find(x => x.ProfileSettingId == profileId).FirstOrDefault();
var tableName = dataSourceData.Name +"_"+ profileData.Name;
var objectType = DynamicTypeBuilder.Createtype(dataSourceData);
var listType = typeof(List<>);
var constructedListType = listType.MakeGenericType(objectType);
AddTableIntempDb(tableName, constructedListType);
return Success();
}
private void AddTableIntempDb(string tableName, Type type)
{
//Code here
}
【问题讨论】:
标签: c# mysql entity-framework-6