我在我的项目中添加了一个新的ADO.Net实体数据模型,并使用更新向导将表添加到模型中.五个选定的表被添加到设计图面.另外两个表不会添加.我在向导中选择它们并单击"完成",但它们从未出现在设计图面上.
这是一个错误,还是有些情况下表格无法添加到模型中(按设计)?
更新:XML(*.edmx)揭示了问题.
<!--Errors Found During Generation:
warning 6013: The table/view 'FooBar.dbo.Roles' does not
have a primary key defined and no valid primary key could be inferred.
This table/view has been excluded. To use the entity you will need to
review your schema, add the correct keys and uncomment it.-->
<!--<EntityType Name="Roles">
<Property Name="role_id" Type="decimal" />
<Property Name="role_desc" Type="nvarchar" MaxLength="30" />
</EntityType>-->
Run Code Online (Sandbox Code Playgroud)
感谢克雷格您的答复.
.net ado.net entity-framework primary-key visual-studio-2008
快速搜索货币正则表达式会带来很多结果.
我选择其中之一的问题是,如果不测试所有边缘情况,正则表达式很难验证.我可以花很多时间在这上面,因为我相信其他数百名开发人员已经做过了.
有没有人有美国货币的正则表达式已经过彻底测试?
我唯一的要求是匹配的字符串是US Currency并解析为System.Decimal:
[ws][sign][digits,]digits[.fractional-digits][ws] Elements in square brackets ([ and ]) are optional. The following table describes each element. ELEMENT DESCRIPTION ws Optional white space. sign An optional sign. digits A sequence of digits ranging from 0 to 9. , A culture-specific thousands separator symbol. . A culture-specific decimal point symbol. fractional-digits A sequence of digits ranging from 0 to 9.
我刚刚开始本地化ASP.Net MVC应用程序.大多数字符串将在资源文件中定义,并通过Matt的Localization Helpers检索.其他字符串必须存储在数据库中.
我的问题:
我应该CurrentUICulture在请求管道中尽早设置并在整个应用程序中使用它,还是Request.UserLanguages[0]在需要时直接使用?
现在我想我应该CurrentUICulture在Application_BeginRequest中设置.实现看起来像这样:
protected void Application_BeginRequest(object sender, EventArgs e)
{
var cultureName = HttpContext.Current.Request.UserLanguages[0];
Thread.CurrentThread.CurrentUICulture = new CultureInfo(cultureName);
}
Run Code Online (Sandbox Code Playgroud)
这是最好的地方CurrentUICulture,是Request.UserLanguages[0]获得这些信息的最佳地点吗?
更新:
Ariel的帖子让我意识到这可以在没有代码的情况下定义,使用web.config
<system.web>
<!--If enableClientBasedCulture is true, ASP.NET can set the UI culture and culture for a Web page automatically, based on the values that are sent by a browser.-->
<globalization enableClientBasedCulture="true" culture="auto:en-US" uiCulture="auto:en"/>
Run Code Online (Sandbox Code Playgroud) 这是一个一般设计问题: 如何在ASP.NET MVC中实现动态(运行时生成)表单?
情况如下:
自定义不需要支持嵌套控件,第三方控件等等,但我怀疑一个非常优雅的设计可以实现这一点.大多数情况下,我只需要管理员能够指定其他字段作为文本框,复选框,单选按钮和组合框.我还需要应用程序为数据分配一个空间以保存在数据库中,但我相信我已经找到了那个部分.
谢谢您的帮助.
问题:
我正在国际化一个ASP.Net MVC应用程序,但带有链接文本的句子让我暂停.以下面的例子为例:
请注意,由于"login"是超链接的,因此我必须让翻译者在文本本地化时表示哪些相应的单词或短语应该被超链接,例如Entre.
我不能成为第一个遇到这个问题的人,那么你所看到或使用的最佳战略解决方案是什么?
是否存在为翻译者表示此类事物的标准(以及使用翻译结果的标准方式)......或者我是否走错了路,期望我的内容和演示信息如此紧密耦合(尽管我可以'在这种情况下,想一想去除耦合的方法).
目前的实施:
我目前正在使用View的本地资源文件和HtmlHelper上的扩展方法来获取本地化的sting:
<%= Html.Resource("LoginMessage")%>
Run Code Online (Sandbox Code Playgroud)
更新: 请参阅Keith的回答.
我发现它最有帮助,但系统自动选择另一个.
我想将App_GlobalResources/Strings.resx编译到我的程序集中(并最终使用Strings.es.resx,Strings.fr.resx等的附属程序集)但是一旦发布应用程序就会出现以下错误:
"无法加载文件或程序集'App_GlobalResources'或其依赖项之一.系统无法找到指定的文件."
重现步骤:
HomeController.Index(),例如ViewData["Message"] = Strings.MyTestASP.NET MVC项目可以使用编译到dll中的字符串资源,如果是这样,我做错了什么?
那么为什么ResourceManager找不到它们呢?它不应该默认回退到主程序集吗?
如何保存xsl:for-each中发生的迭代?(XSL中的变量是不可变的)
我的目标是找到特定级别的任何节点的MAX子节点数.
例如,我可能希望打印出此调查中任何问题的响应节点不超过2个:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="testing.xsl"?>
<Survey>
<Question>
<Response text="Website" />
<Response text="Print Ad" />
</Question>
<Question>
<Response text="Yes" />
</Question>
</Survey>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<html>
<head>
</head>
<body>
<xsl:for-each select="Survey">
The survey has <xsl:value-of select="count(child::Question)"/> questions.
<br />
<xsl:variable name="counter">0</xsl:variable>
<xsl:for-each select="Question">
<!-- TODO: increment the counter ??????? -->
</xsl:for-each>
No more than <xsl:value-of select="$counter"/> responses were returned for any question.
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Run Code Online (Sandbox Code Playgroud) 我相信对于大多数人来说这是一个简单的方法...将静态HTML(从光盘上的html文件)注入视图的最佳方法是什么?
我想要的东西是这样的:
<%= Html.RenderPartial(pathToMyHtmlFile) %>
Run Code Online (Sandbox Code Playgroud) 是否可以在C#ASP.Net服务器上调用Node.js方法/模块?我发现了Edge.JS库,但据我所知,它允许在Node.JS上调用C#代码.我需要直接反向解决方案.
我在我的实体数据模型中有一个存储过程,并将其添加到函数导入中.
问题是......当且仅当我将返回指定为实体类型时,Visual Studio才会在模型的代码隐藏中生成函数代码. 标量和null返回类型不起作用.选择它们时,Visual Studio不会生成功能代码.
有什么我想念的,或者这是一个错误?
任何解决方法?
asp.net-mvc ×5
.net ×2
ado.net ×2
localization ×2
.net-3.5 ×1
asp.net ×1
c# ×1
currency ×1
dynamic-data ×1
edge.js ×1
for-loop ×1
hyperlink ×1
node.js ×1
primary-key ×1
regex ×1
xml ×1
xslt ×1