我需要在onet.xml中指定Web部件连接.因此,当使用此站点定义创建站点时,所述Web部件已经连接并且可以使用.我需要在onet.xml中为特定Web部件指定哪些属性.
我研究使用Visual Studio在C#/ .NET中开发的应用程序.在我的方法的原型中,ReSharper经常建议我用更通用的输入参数替换输入参数的类型.例如,List <> with IEnumerable <>如果我只在我的方法体中使用带有foreach的列表.我可以理解为什么写这个看起来更聪明,但我非常关心性能.我担心如果我听ReSharper我的应用程序的性能会降低...
当我写作时,有人能够(或多或少)向我解释幕后发生的事情(即在CLR中):
public void myMethod(IEnumerable<string> list)
{
foreach (string s in list)
{
Console.WriteLine(s);
}
}
static void Main()
{
List<string> list = new List<string>(new string[] {"a", "b", "c"});
myMethod(list);
}
Run Code Online (Sandbox Code Playgroud)
和有什么区别:
public void myMethod(List<string> list)
{
foreach (string s in list)
{
Console.WriteLine(s);
}
}
static void Main()
{
List<string> list = new List<string>(new string[] {"a", "b", "c"});
myMethod(list);
}
Run Code Online (Sandbox Code Playgroud) 所以这就是问题所在.
我使用Anchors作为一种非刷新的方式来允许当前视图对象的书签.
HTTP://myserver/showobject.aspx#objectid=10
我使用这个,所以当更新对象id时,它不会尝试在页面上刷新.
继承人.
我正在使用表单身份验证来处理对这些页面的访问.因此,当您尝试在未先登录的情况下浏览上述链接时,会将您重定向到登录页面.一旦您成功通过身份验证,就可以将FormsAuthentication.RedirectFromLoginPage(...)转到您来自的页面.
除了它将#objectid = 10位中断.
我想了几个hacks(在重定向到登录页面之前设置一个cookie然后读取cookie并在"RedirectFromLoginPage"完成后更新链接)来解决这个问题,但是想知道是否有任何真正的方法使FormsAuthentication.RedirectFromLoginPage做我真正想要它做的事情.
回顾一下:
重定向到登录
当前/错误行为:登录到http://myserver/showobject.aspx后重定向 - sans#objectId = 10
未来/正确的行为:登录后重定向到完成原始URL,http://myserver/showobject.aspx#objectId=10
感谢您提前协助,
约翰.
我们可以编写一个在更新任何列表时被触发的事件接收器.我们必须为eventreceiver指定的listtemplateid使我们的代码特定于一种列表.如果我们想要在所有站点列表上执行事件代码,该怎么办?
我正在使用SharePoint Designer将asp服务器控件放入我的SharePoint XSLT中.我发现将值预先填充到表单中,或提供与SharePoint定义的布局(隐藏字段等)不同的体验非常方便.
例如,如果我这样定义它,我可以使用asp:TextBox控件而不是SharePoint:FormField控件:
<xsl:stylesheet ... xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime">
<xsl:param name="Name" />
<xsl:template match="/">
<!-- omitted for clarity -->
<asp:TextBox id="txtName" runat="server" Text="{$Name}"
__designer:bind="{ddwrt:DataBind('i','txtName','Text','TextChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@MySharePointField')}"
</xsl:template>
</xsl:stylesheet>
Run Code Online (Sandbox Code Playgroud)
我用谷歌搜索但似乎无法找到ddwrt:DataBind方法的参数的良好参考.
有人知道吗?
如何在以下内容中忽略特定的VS代码分析规则(例如CA1305:Microsoft.Globalization):
(假设这些选项都是可能的.)
我最近看到一个WCF服务通过ref参数声明操作合同.
我不知道为什么要做出这样的设计决定(操作无效),而且,根据我的WCF知识,我无法说这是否是一个好的做法.或者如果这不相关.
你怎么看?
如何使用JavaScript刷新Telerik RadGrid控件?
我有一个Visual Studio 2008项目,证明很难调试.我需要附加到IIS 7来调试它.在附加到w3wp.exe后不久,我至少有50%的时间收到以下错误:
--------------------------- Microsoft Visual Studio --------------------------- A fatal error has occurred and debugging needs to be terminated. For more details, please see the Microsoft Help and Support web site. HRESULT=0x8007000e. ErrorCode=0x0. --------------------------- OK ---------------------------
然后它终止w3wp.exe.
我没有遇到任何其他解决方案的问题.有关如何解决此问题的任何想法吗?
如何更改自动生成的多对多表的命名约定?
假设我有两个类:
public class User
{
public int UserId { get; set; }
public virtual List<Role> Roles { get; set; }
}
public class Role
{
public int RoleId { get; set; }
public virtual List<User> Users { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
默认情况下,这将创建一个名为UserRoles的表.
我可以将一个表的名称更改为UsersInRoles,例如,在我的DbContext的OnModelCreating覆盖中使用以下内容:
modelBuilder.Entity<User>()
.HasMany(p => p.Roles)
.WithMany(p => p.Users)
.Map(mc =>
{
mc.MapLeftKey("UserId");
mc.MapRightKey("RoleId");
mc.ToTable("UsersInRoles");
});
Run Code Online (Sandbox Code Playgroud)
但是,我真正想要做的是更改命名约定,以便默认情况下,所有自动生成的多对多表都使用此新约定.我无法弄清楚如何做到这一点,或者甚至可能.我不希望每次指定其中一个关系时都必须指定9行额外代码.
我目前正在使用EF版本6.0.0-rc1.
.net ×3
asp.net ×3
sharepoint ×3
c# ×2
anchor ×1
arguments ×1
byref ×1
clr ×1
iis ×1
interface ×1
javascript ×1
moss ×1
performance ×1
telerik ×1
wcf ×1
web-parts ×1
web-services ×1
xslt ×1