在我的silverlight应用程序中,我正在尝试使用LINQ创建数据库连接.首先,我添加一个新的LINQ to SQL类,并将名为"tblPersoon"的表拖入其中.
然后在我的服务文件中,我尝试执行以下查询:
[OperationContract]
public tblPersoon GetPersoonByID(string id)
{
var query = (from p in tblPersoon where p.id == id select p).Single();
Run Code Online (Sandbox Code Playgroud)
但是在tblPersoon它给了我以下错误.
无法找到源类型"SilverlightApplication1.Web.tblPersoon"的查询模式的实现.'哪里'找不到.
即使我尝试以下内容:
var query = (from p in tblPersoon select p).Single();
Run Code Online (Sandbox Code Playgroud)
它给我一个错误,说'找不到'!
我的表的生成类的代码可以在这里找到:http://pastebin.com/edx3XRhi
造成这种情况的原因是什么,我怎么能解决这个问题?
谢谢.
将我的应用程序放在Web服务器上并尝试"登录"时出现以下错误:
Server Error in '/' Application.
Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where …Run Code Online (Sandbox Code Playgroud) 我今天早上更新到Visual Studio 2015 Update 3,在我的主网络解决方案中,当我打开它时,我现在收到以下警告.当我打开打字稿文件时,我也会收到此警告,我无法再通过快捷方式或工具栏注释和取消注释代码.我也不再有智能感知......
在xml文件中,它说如下:
<entry>
<record>851</record>
<time>2016/07/04 11:40:28.893</time>
<type>Error</type>
<source>VisualStudio</source>
<description>LegacySitePackage failed for package [Microsoft.VisualStudio.LanguageServices.TypeScript.TypeScriptPackage, Microsoft.VisualStudio.LanguageServices.TypeScript, Version=14.0.0.0, Culture=neutral]Source: 'Microsoft.VisualStudio.LanguageServices.TypeScript' Description: Field not found: 'Microsoft.CodeAnalysis.Shared.Options.ServiceFeatureOnOffOptions.ClosedFileDiagnostic'.
System.MissingFieldException: Field not found: 'Microsoft.CodeAnalysis.Shared.Options.ServiceFeatureOnOffOptions.ClosedFileDiagnostic'.
 at Microsoft.VisualStudio.LanguageServices.TypeScript.TypeScriptPackage.Initialize()
 at Microsoft.VisualStudio.Shell.Package.Microsoft.VisualStudio.Shell.Interop.IVsPackage.SetSite(IServiceProvider sp)</description>
<guid>{2FFE45C4-5C73-493C-B187-F2E955FF875E}</guid>
<hr>80131511</hr>
<errorinfo></errorinfo>
</entry>
<entry>
<record>852</record>
<time>2016/07/04 11:40:28.895</time>
<type>Error</type>
<source>VisualStudio</source>
<description>SetSite failed for package [Microsoft.VisualStudio.LanguageServices.TypeScript.TypeScriptPackage, Microsoft.VisualStudio.LanguageServices.TypeScript, Version=14.0.0.0, Culture=neutral](null)</description>
<guid>{2FFE45C4-5C73-493C-B187-F2E955FF875E}</guid>
<hr>80131511</hr>
<errorinfo></errorinfo>
</entry>
<entry>
Run Code Online (Sandbox Code Playgroud)
我尝试过的:
所以现在我的Visual Studio告诉我安装了TypeScript版本1.8.30.
但在我的程序和功能中,我只安装了verison 1.8.6.0(这是最新的).

只剩下要做的就是重新安装Visual Studio本身.
有什么想法,建议吗?谢谢!
我最近将新的.NET编译器NuGet包(Microsoft.CodeDom.Providers.DotNetCompilerPlatfor)添加到现有的旧版MVC.NET网站.现在,当尝试发布网站时,我得到以下异常:
找不到路径的一部分...\obj\DEV\AspnetCompileMerge\Source\bin\roslyn\csc.exe'
我已尝试过这个问题中提到的所有内容,但没有任何效果.毕竟,这是一个稍微不同的问题.该帖子中提到的问题是构建异常,我的解决方案在本地构建良好.卸载NuGet包有效,但这不是一个真正的解决方案.
问题是基本相同,这一个,但也无解.
发布输出:
4>------ Publish started: Project: Jdn.ArticleCatalogue.Web, Configuration: DEV Any CPU ------
4>Connecting to \\vm-arcawebdev01\WEBSITES\ArticleCatalogue...
4>Transformed Web.config using D:\DOTNET\Local\Logistics.Web\Portal\DEV\Application Projects\Article Catalogue\Jdn.ArticleCatalogue.Web\Web.DEV.config into obj\DEV\TransformWebConfig\transformed\Web.config.
4>Copying all files to temporary location below for package/publish:
4>obj\DEV\AspnetCompileMerge\Source.
4>C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -v / -p "D:\DOTNET\Local\Logistics.Web\Portal\DEV\Application Projects\Article Catalogue\Jdn.ArticleCatalogue.Web\obj\DEV\AspnetCompileMerge\Source" "D:\DOTNET\Local\Logistics.Web\Portal\DEV\Application Projects\Article Catalogue\Jdn.ArticleCatalogue.Web\obj\DEV\AspnetCompileMerge\TempBuildDir" -keyfile "..\..\..\Solution Items\Jdn.LogisticsPortal.snk"
4>ASPNETCOMPILER(0,0): Error ASPRUNTIME: Could not find a part of the path 'D:\DOTNET\Local\Logistics.Web\Portal\DEV\Application Projects\Article Catalogue\Jdn.ArticleCatalogue.Web\obj\DEV\AspnetCompileMerge\Source\bin\roslyn\csc.exe'.
Run Code Online (Sandbox Code Playgroud)
关于如何解决这个问题的任何想法?
我设法将Image转换为varbinary并将其存储在我的数据库中.我一直在尝试将varbinary转换为Image,但我在这里遇到了麻烦.
首先,我在我的服务中从我的数据库中获取Binary.
public Binary getAfbeelding(int id)
{
var query = (from p in dc.Afbeeldings
where p.id == id
select p.source).Single();
Binary source = query;
return source;
}
Run Code Online (Sandbox Code Playgroud)
然后我尝试使用StackOverflow上的代码将varbinary转换为图像:
public static string convertToImage(Binary source)
{
byte[] b = source.ToArray();
MemoryStream ms = new MemoryStream(b);
Image img = Image.FromStream(ms);
return img.Source.ToString();
}
Run Code Online (Sandbox Code Playgroud)
我在打电话之前遇到了麻烦new MemoryStream:
'ondernemersAward.EditAfbeeldingServiceReference.Binary'不包含'ToArray'的定义,并且没有扩展方法'ToArray'接受类型'OndernemersAward.EditAfbeeldingServiceReference.Binary'的第一个参数可以找到(你是否缺少using指令或程序集引用?)
出于一些奇怪的原因,我不能使用"普通"二进制文件,它总是会告诉我使用OndernemersAward.EditAfbeeldingServiceReference.Binary哪个是我的ServiceReference,如您所见.
怎么解决这个问题?
在我的应用程序中,我有一个可以拥有多个位置的客户.当您在我的下拉框中选择一个客户时,它会在一个包含所有位置的flowlayoutpanel中加载组合框.
这是我的代码:
IEnumerable<locatie> opstapPlaatsen = Database.getOpstapplaatsen(klant.klant_id);
foreach (locatie opstapplaats in opstapPlaatsen)
{
if (opstapPlaatsen.Count() <= 0)
{
}
else
{
ComboBox cbbOpstap = new ComboBox();
cbbOpstap.Width = 200;
cbbOpstap.Height = 20;
cbbOpstap.DataSource = Database.getLocaties();
cbbOpstap.ValueMember = "locatie_id";
cbbOpstap.SelectedValue = opstapplaats.locatie_id;
cbbOpstap.SelectedItem = opstapplaats;
cbbOpstap.DisplayMember = "FullAdress";
flpOpstapplaats.Controls.Add(cbbOpstap);
}
}
Run Code Online (Sandbox Code Playgroud)
我的问题是我无法设置SelectedItem或/和Value.当我查看断点时,有一个值opstapplaats.locatie_id(正确的值),但SelectedValue保持不变null.
我在循环之外做了类似的事情,对于没有在代码中创建的组合框,它在那里工作.

我不知道是什么原因造成的?这是因为它是在一个foreach,因为我在foreach之前使用它然后它工作.
谢谢,托马斯.
编辑:这个问题还没有解决,我不知道如何解决它.
编辑:这个问题似乎已经解决了.见接受的答案.
在我目前的应用程序中,我有main form: frmMain一个statusstrip和一个label: lblStatus内部.我想从我的用户控件中更新该标签,当我点击相关按钮时,我将其添加到我的主窗体中:
ucBeheer ucBeheer = new ucBeheer();
splitContainer1.Panel2.Controls.Add(ucBeheer);
Run Code Online (Sandbox Code Playgroud)
从我内心usercontrol做的时候,我想更新lblStatus.我尝试将以下属性添加到我的主窗体:
public string updateStatus
{
get { return lblStatus.Text; }
set { lblStatus.Text = value; }
}
Run Code Online (Sandbox Code Playgroud)
然后在我的用户控件中访问这样的方法:
frmMain mainForm = new frmMain();
mainForm.updateStatus = "This is a test";
Run Code Online (Sandbox Code Playgroud)
但这不起作用,我知道这是因为我正在制作我的新对象frmMain,但我不知道如何解决这个问题呢?
我也发现了以下方式,Event Handler但是我不能这样做,因为我的用户控件实际上还没有在我的mainForm中,直到我在那里添加它,点击按钮,所以我没有引用它.
所以我有点想法,我希望有人可以帮助我.谢谢,托马斯
编辑:所以我设法通过以下方式完成:
frmMain owningForm = (frmMain)this.Parent.Parent.Parent.Parent;
owningForm.updateStatus = "This is a test";
Run Code Online (Sandbox Code Playgroud)
但this.Parent.Parent.Parent.Parent...对我来说似乎不是很好的编码,有没有其他方法可以获得最顶级的父母?