diff --git a/IoTGateway.ViewModel/BasicData/DriverVMs/DriverVM.cs b/IoTGateway.ViewModel/BasicData/DriverVMs/DriverVM.cs
index 29d7bdb..c424ccf 100644
--- a/IoTGateway.ViewModel/BasicData/DriverVMs/DriverVM.cs
+++ b/IoTGateway.ViewModel/BasicData/DriverVMs/DriverVM.cs
@@ -36,6 +36,13 @@ namespace IoTGateway.ViewModel.BasicData.DriverVMs
public override void DoEdit(bool updateAllFields = false)
{
+ var DriverService = Wtm.ServiceProvider.GetService(typeof(DriverService)) as DriverService;
+ Entity.AssembleName = DriverService.GetAssembleNameByFileName(Entity.FileName);
+ if (string.IsNullOrEmpty(Entity.AssembleName))
+ {
+ MSD.AddModelError("", "程序集获取失败");
+ return;
+ }
base.DoEdit(updateAllFields);
}
diff --git a/IoTGateway/Areas/BasicData/Views/Driver/Edit.cshtml b/IoTGateway/Areas/BasicData/Views/Driver/Edit.cshtml
index b306514..202b36c 100644
--- a/IoTGateway/Areas/BasicData/Views/Driver/Edit.cshtml
+++ b/IoTGateway/Areas/BasicData/Views/Driver/Edit.cshtml
@@ -5,7 +5,7 @@
-
+
diff --git a/Plugins/Plugin/DeviceService.cs b/Plugins/Plugin/DeviceService.cs
index 408b92b..7441380 100644
--- a/Plugins/Plugin/DeviceService.cs
+++ b/Plugins/Plugin/DeviceService.cs
@@ -82,9 +82,9 @@ namespace Plugin
{
var systemManage = dc.Set().FirstOrDefault();
var driver = DrvierManager.DriverInfos
- .SingleOrDefault(x => x.Type.FullName == device.Driver.AssembleName);
+ .SingleOrDefault(x => x.Type.FullName == device.Driver?.AssembleName);
if (driver == null)
- _logger.LogError($"找不到设备:[{device.DeviceName}]的驱动:[{device.Driver.AssembleName}]");
+ _logger.LogError($"找不到设备:[{device.DeviceName}]的驱动:[{device.Driver?.AssembleName}]");
else
{
var settings = dc.Set().Where(x => x.DeviceId == device.ID).AsNoTracking()