##C#笔记
c#笔记搬运工_210716
…不允许外接设备拷贝的搬运工…
【线程】
ThreadPool.QueueUserWorkItem(ThreadDoFunction); //线程空闲时运行
ThreadPool.QueueWorkItem(new WaitCallback((obj) =>
{
StatusRefresh(CancellationTokenSource.Token);
}));//回调
.net core 微服务
//微服务配置 客户端 > 服务器
<Node Name="Task">
<Plugin Name="MCDevMacrosServer"/>
</Node>
<Node Name="Link">
<Plugin Name="MCDeviceServer"/>
</Node>
IBaseConsumer
客户端 MicroServices.Consumer.BL.dll
服务器 MicroServices.BL.dll
服务器IF
[ServiceRoute(“GetCollections”, Description = “获取集合”)]
GetCollections(){…}
当前系统采用秒监测更新,异步实时上报
NetMQHelper.Instance.Publisher.Publish();
//MQData 消息处理
//MetaData 数据处理
加载程序集
Assembly.Load(“xxx”//程序集名 ).GetType(//例 “CET.MCS.Param”);
Protobuf 详解
http://blog.youkuaiyun.com/q__y__L/article/details/86740156
Device基类
namespace xxx
{
[Serializable]
public class Device : IDevice, ICommReport
{............}
//public interface IDevice { } 接口
//public interface ICommReport { } 上报接口
}
【Action】
public Action<string> StatusReport { get; set;}
public event Action<int, string> ActionControl;
ActionControl += Function2; //事件,类似函数指针
ActionControl?.Invoke(intxx, stringxx); //调用
字节数组 > 类型
Marshal.AllocHGlobal()
Marshal.Copy()
Marshal.PtrToStructure() // 主要
Marshal.FreeHGlobal()
【SQL 查询所有表】
select table_name from
information_schema.tables where
table_schema='testdb';
【查询是否存在xxx表】
select count(*) from
(select table_name from
information_schema.tables where
table_schema='testdb') as table_a
where table_a.table_name='tb_test_1';