我使用SQL Server CLR集成来创建一个ASSEMBLY.
加载命令:
CREATE ASSEMBLY TcpClr FROM 'G:\TcpClrTest.dll' WITH PERMISSION_SET = UNSAFE
没有App.Config
DLL代码包含:
string ip=ConfigurationManager.AppSettings["connection"].ToString();
App.config还包含:
<appSettings>
<add key="connection" value="127.0.0.1"/>
</appSettings>
但是当我执行PROCEDURE时,SQL Server显示错误 System.NullReferenceException
SQL Server CLR集成是否支持App.config文件?
c# sql-server configurationmanager sqlclr configuration-files
我创建了一个这样的模型
import Foundation
class Play:ObservableObject{
@Published var name:String="Tayle"
@Published var age:Int=12
}
Run Code Online (Sandbox Code Playgroud)
它将在两个视图中使用
例如:
struct Demo: View {
//1
@State private var play:Play = Play()
//2
//@StateObject private var play:Play = Play()
var body: some View {
NavigationView{
NavigationLink(destination: PlayNameView(play: play)){
Text("go to platnbame")
}
}
}
}
struct PlayNameView:View{
@ObservedObject var play:Play
var body: some View{
HStack{
Text("Hello,\(play.name)")
Button(action:{
play.name="iop"
}){
Text("change the name to:iop")
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
当我运行该项目时,他们有相同的行为。如果@StateObject可以做到,为什么还要选择@State