虚拟绑定属性问题 [英] Virtual binding property Question

查看:59
本文介绍了虚拟绑定属性问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我有一个设置为布尔值的绑定,用于检查用户是否拥有页面权限。


我将此设置为一个数字我的xaml代码中的项目。


我看到一个错误,它说它在我的app.config文件中找不到连接字符串'myConnStr'。对数据库的调用也是异步代码。这是使用EF 6.是否有可能,基于绑定,它可以在
之前触发我的代码有机会实际设置连接字符串并从app.config加载它?


这也很奇怪,因为当我没有调试和开发时,它正在激活! 我会得到一个随机弹出的随机错误消息框! 我只是在Visual Studio中工作,而不是运行应用程序! (我发现我正在捕获
我的错误然后将它们记录到Windows事件查看器并且意外地留下了消息框 - 所以这就是它会随机弹出的原因)。无论如何,我修复了所以现在消息框根本没有显示,但我仍然在
windows事件查看器中看到很多事件,说我的app.config文件中找不到连接字符串。 


有没有人见过这个?我可以在应用程序从数据库中读取之前触发为HasPermissions设置布尔值的代码吗?

解决方案

嗨ttaylor29,


>> 我'我看到一个错误,它说它在我的app.config文件中找不到连接字符串'myConnStr'。 


根据你的描述和错误, 我建议你检查app.config文件中的connectionstring,看看是否有一些连接字符串。

 connectionString = ConfigurationManager.ConnectionStrings [" str"]。ConnectionString ; 


最好的问候,


Cherry


Hello, I have a binding that is set up as a Boolean that checks to make sure a user has permission to a page.

I have this set to a number of items on my xaml code.

I'm seeing an error where it says it cannot find the connection string 'myConnStr' in my app.config file. The call to the database is in asynchronous code as well. This is using EF 6. Is it possible, based on the bindings, that it could be firing BEFORE my code has had a chance to actually set up the connection string and load it from the app.config?

It is weird as well because this is firing EVEN when I am not debugging and developing!  I will get a random error message box that pops up every now and then!  I am just working in Visual Studio and not running the app! (I figured out I was catching my errors and then logging those to the Windows Event Viewer and the message box was accidentally left in - so that is why it would randomly pop up). Anyways, I fixed that so now the message box does not show up at all, but I still see a lot of events in my windows event viewer that are saying that a connection string cannot be found in my app.config file. 

Has anyone seen this? Can my code to set the Boolean for HasPermissions be fired before the application can read from the database?

解决方案

Hi ttaylor29,

>>I'm seeing an error where it says it cannot find the connection string 'myConnStr' in my app.config file. 

According to your description and error,  I suggest you to check connectionstring in app.config file, and let see if there are some connectionstring.

connectionString = ConfigurationManager.ConnectionStrings["str"].ConnectionString;

Best Regards,

Cherry


这篇关于虚拟绑定属性问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆