假设我们正在为中小型企业开发电子商务Web应用程序.让我们进一步假设业务可能会随着时间的推移而扩展.换句话说,产品线通常会增长.
到目前为止,我已经在SqlHelper类的帮助下使用ADO.NET和存储过程开发了n层解决方案.对于更大的应用程序,我使用了Enterprise Library(2.0).
我想转向基于ORM的方法,并开始学习LINQ以及从ASP.NET Web Forms切换到ASP.NET MVC.我不想使用LINQ-to-SQL.问题不在于是否需要ORM,而是实体框架ORM对于此类项目是否过度.如果有必要保证手头的任务,我不介意学习曲线.
关于"矫枉过正",我想知道是否:
事实上,如果有人认为ORM对这样的项目来说太过分了,我想听听原因.
<asp:LinkButton ID="cartLink" runat="server" Text="<b>Add to Cart</b>"
ToolTip="Add to cart" CommandName="Add"
CommandArgument='<%# Eval("ProductID") %>' />
Run Code Online (Sandbox Code Playgroud)
查看来源:
<a id="ContentPlaceHolder1_productsList_cartLink_0"
title="Add to cart"
href="javascript:__doPostBack('ctl00$ContentPlaceHolder1$productsList$ctrl0$cartLink','')">
<b>Add to Cart</b></a>
Run Code Online (Sandbox Code Playgroud)
当鼠标悬停在LinkButton上时,我不会丢失显示在浏览器底部的丑陋的"javascript_doPostBack(...)"链接状态消息.
有可能抑制这个吗?
更新05-11-2011:
我意识到这是默认行为,大多数时候我几乎没有注意到它.但是,当状态栏未显示时(默认情况下),这只是IE9中的问题.有人知道一个工作黑客来解决这个问题吗?
在IIS 7中管理ASP.NET缓存的方式/位置是什么?我知道它存储在服务器的内存中,但管理它的过程是什么?它是在w3wp.exe的地址空间中,还是在另一个进程/位置?会话数据是否使用缓存,或者会话的工作方式不同吗?
经典的ADO.NET是否仍然普及并且与许多开发人员一起使用,插入,读取数据等?
即使我们现在有LINQ和EF.
面对它非常简单的问题...当我正在调试传递查询字符串参数的Web表单时,我通常会附加到进程并使用URL中的查询参数刷新页面.
在VS 2010中有更好,更明显的方法吗?
如果我有一个使用javascript的网站,如果他们启用了javascript,用户将获得最完整的网站体验,但即使javascript被禁用,它仍将完全正常运行.有没有办法检查用户是否为他们正在使用的浏览器禁用了javascript,因此我可以显示如下消息:"网站最好用javascript启用"
我在Central Admin中显示12.0.0.6421,这似乎表明安装了SP2.但是,当我运行STSADM命令来备份网站集时,我没有看到消息通知我它"将网站集设置为仅在备份期间读取",如下所述:
http://bobfox.securespsite.com/FoxBlog/Lists/Posts/Post.aspx?ID=121
我只是得到了"操作成功完成"的消息,我曾经得到过SP2之前的消息.这是否意味着SP2未正确安装?
我正在尝试使用AlternateView来满足 HTML 和文本客户端的需求。我更喜欢使用 HTML 并且只在必要时回退到文本。我开始重新编码一个旧的控制台应用程序来做到这一点,但我的代码中仍然有回车符和换行符作为“/r/n”,我的问题是试图弄清楚如何以及在哪里使用 Environment.Newline 而不是这些?
现在,正在从 Web 表单调用控制台应用程序。我在调试时遇到了一些困难,最终计划是为此创建一个 WCF 服务。
我认为我遇到的困难是确定 AlternateView 实际为我做什么,而不是我必须在文本和 HTML 版本中分别明确编码多少电子邮件正文。具体来说,我在以下代码的最后一个 else 块中仍然有旧的回车符和换行符,我正在尝试找出一种更优雅的方法来做到这一点。
// args[0] - Subject
// args[1] - Message (uses all Environment.Newlines)
// args[2] - RfpID
static void Main(string[] args)
{
string subject = args[0];
string message = args[1];
// Get programatic access to the email information stored in the web.config file
string emailHost = WebConfigurationManager.AppSettings["EmailHost"];
string fromAddress = WebConfigurationManager.AppSettings["FromEmailAddress"];
SmtpClient client = new SmtpClient(emailHost);
int count = 0;
using …Run Code Online (Sandbox Code Playgroud) 尝试在简单的联系表单上实现数据验证和错误处理.当我添加检查ModelState.IsValid我是鸡和鸡蛋的情况.我已经看过其他类似的问题,我只是没有得到这个.从Web Forms迁移到MVC并挣扎.尝试根据正在发生的事情切换HTML元素 - 成功/错误消息等.现在,甚至验证都不起作用.
现在我只是想让服务器端验证工作,但欢迎提供有关如何添加客户端验证的建议; 例如,是否有必要使用jQuery或者有什么内容?
视图:
@using (Html.BeginForm("Contact", "Home", FormMethod.Post))
{
if (ViewData["Error"] == null && ViewData["Success"] == null)
{
<h3>Send us an email</h3>
Html.ValidationSummary(true);
<div class="form-group">
<label class="sr-only" for="contact-email">Email</label>
<input type="text" name="email" placeholder="Email..."
class="contact-email" id="contact-email">
</div>
<div class="form-group">
<label class="sr-only" for="contact-subject">Subject</label>
<input type="text" name="subject" placeholder="Subject..."
class="contact-subject" id="contact-subject">
</div>
<div class="form-group">
<label class="sr-only" for="contact-message">Message</label>
<textarea name="message" placeholder="Message..."
class="contact-message" id="contact-message"></textarea>
</div>
<button type="submit" class="btn">Send it</button>
<button type="reset" class="btn">Reset</button>
}
else if (ViewData["Error"] == null && ViewData["Success"] != null) …Run Code Online (Sandbox Code Playgroud) 鉴于以下内容:
protected bool IsPalindrome(uint x) // Samples: 1221, 456653
{
}
Run Code Online (Sandbox Code Playgroud)
确定输入是否为回文的最佳方法是什么?最初,我通过将输入数字放入一个数组,在for循环中将其反转并将其分配给临时数组进行比较来尝试数组.然而索引语法变得非常快,所以我决定简单地将uint视为字符串.
以下是面试白板情况下的有效解决方案,还是我仍然过于复杂?
protected bool IsPalindrome(uint x)
{
string givenNum = Convert.ToString(x);
char[] input = givenNum.ToCharArray();
Array.Reverse(input);
string testString = String.Empty;
foreach (char a in input)
testString += a;
if (givenNum == testString)
return true;
else
return false;
}
Run Code Online (Sandbox Code Playgroud) asp.net ×9
c# ×2
javascript ×2
ado.net ×1
arrays ×1
asp.net-mvc ×1
caching ×1
debugging ×1
email ×1
forms ×1
html ×1
iis-7 ×1
moss ×1
orm ×1
sharepoint ×1
string ×1
validation ×1
webforms ×1