我有一个PowerShell脚本,我用它来创建从几个地方复制编译文件并使用winrar压缩它们的发行版.在脚本中,我切换到包含我要运行的文件夹的目录并执行此操作:
Invoke-Expression ($WinRAR + " a " + $zipPath + " " + $WinRARFilter + " " + $DistName + "-zip " + $WinRAROpts)
Run Code Online (Sandbox Code Playgroud)
实际执行此操作:
E:\Progs\WinRar\WinRar.exe a C:\Users\Echilon\Documents\Coding\ResourceBlender-Express\trunk\dist\resourceblender-express_1.44-zip.zip -x*\.svn\* -x*\.svn -x\.svn resourceblender-express-zip -r -s -m5 -inul
Run Code Online (Sandbox Code Playgroud)
但是没有.svn目录从zip文件中排除.这曾经工作,我不知道为什么现在没有,但我不能让它排除正确的文件.
完整脚本位于http://resourceblender.codeplex.com/sourcecontrol/changeset/view/27742?projectName=resourceblender#456701(位于脚本底部)的codeplex上
那些有一些PowerShell经验的人能否对此有所了解?
我正在使用EF尝试使用ASP.NET更新实体.我正在创建一个实体,设置它的属性然后将其传递回具有ID的单独图层上的EF,以便可以应用更改.我这样做是因为我只存储实体的ID,当它绑定到UI控件时.
一切都适用于标准属性,但我无法更新产品(相关实体)的Category.ID.我已经尝试过EntityKey,EntityReference和其他一些但不保存类别ID.这就是我所拥有的:
Product product = new Product();
product.CategoryReference.EntityKey = new EntityKey("ShopEntities.Categories", "CategoryID", categoryId);
product.Name = txtName.Text.Trim();
... other properties
StockControlDAL.EditProduct(productId, product);
public static void EditProduct(int productId, Product product) {
using(var context = new ShopEntities()) {
var key = new EntityKey("ShopEntities.Products", "ProductID", productId);
context.Attach(new Product() { ProductID = productId, EntityKey = key });
context.AcceptAllChanges();
product.EntityKey = key;
product.ProductID = productId;
context.ApplyPropertyChanges("ShopEntities.Products", product);
context.SaveChanges();
}
}
Run Code Online (Sandbox Code Playgroud)
我真的想使用EF,但我似乎在使用ASP.NET时遇到了一些问题.
几个月前我在MSDN上阅读一篇文章,并且最近开始使用以下代码片段来执行ADO.NET代码,但我觉得它可能很糟糕.我是在反应还是完全可以接受?
private void Execute(Action<SqlConnection> action)
{
SqlConnection conn = null;
try {
conn = new SqlConnection(ConnectionString);
conn.Open();
action.Invoke(conn);
} finally {
if (conn != null && conn.State == ConnectionState.Open) {
try {
conn.Close();
} catch {
}
}
}
}
public bool GetSomethingById() {
SomeThing aSomething = null
bool valid = false;
Execute(conn =>
{
using (SqlCommand cmd = conn.CreateCommand()) {
cmd.CommandText = ....
...
SqlDataReader reader = cmd.ExecuteReader();
...
aSomething = new SomeThing(Convert.ToString(reader["aDbField"]));
}
});
return aSomething;
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用AdaptivePayments通过我的网站将资金从一个用户发送给另一个用户,因此我可以检查他们是否确实已经完成了付款.付款通过,但他们没有返回我的网站,所以我无法跟踪付款.
我正在重定向到`https://www.sandbox.paypal.com/webscr&cmd=_ap-payment&paykey=MYKEY但是我快到了'我的帐户'并看到付款成功,但没有重定向.
我也试过重定向到https://sandbox.paypal.com/webapps/adaptivepayment/flow/pay?&paykey=MYKEY但是我得到:
此交易已获批准.请访问您的PayPal帐户概述以查看详细信息.
我通过设置重定向,NVPRequest["returnUrl"] = "http://mysite.com/APReturn.aspx但这似乎被忽略了.有没有办法做到这一点或更好的方法来实现我的需要?
我在VB.net中遇到了无法预测的无效预测效果.有问题的对象定义了一个属性:
Public Property Value As Int32?
Run Code Online (Sandbox Code Playgroud)
当我尝试使用合并值时IIf,我得到一个null异常
cmd.Parameters.AddWithValue("@HOValue", IIf(headOffice.Value.HasValue, headOffice.Value .Value, DBNull.Value))
Run Code Online (Sandbox Code Playgroud)
在C#中,我知道没有隐式转换为nullables,因此你不能使用??,但为什么在VB.NET中评估IIf的第一部分呢?
我的应用程序具有自定义角色和成员资格提供程序.我已经注册他们在web.config中,但是当我尝试这样做if(User.IsInRole("Blah")),既不是我在RoleProvider的断点Initialize或IsUserInRole被击中.会员提供商工作正常,所以我想我必须从web.config中遗漏一些东西.这就是我所拥有的:
<system.web>
...
<membership defaultProvider="MyAppMembershipProvider" userIsOnlineTimeWindow="15">
<providers>
<clear />
<add name="MyAppMembershipProvider"
type="MyAppMembership.MyAppMembershipProvider"
connectionStringName="MyApp"
enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" writeExceptionsToEventLog="false" />
</providers>
</membership>
<roleManager defaultProvider="MyAppRoleProvider">
<providers>
<clear />
<add name="MyAppRoleProvider"
type="MyAppMembership.MyAppRoleProvider"
connectionStringName="MyApp"
enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" writeExceptionsToEventLog="false" />
</providers>
</roleManager>
</system.web>
Run Code Online (Sandbox Code Playgroud)
还有其他我需要的东西吗?
asp.net iis asp.net-membership roleprovider membership-provider
我正在尝试创建一个规则来匹配所有以类为开头icon-的btn类.[class^="icon-"] {匹配第一个条件,但如何添加"也有.btn类?
我有反变量接口的问题,我不确定解决它的最佳方法.这些是我的课程:
public interface IObject {
}
public interface IBigObject : IObject {
}
public interface ISmallObject : IObject {
}
public class AnObject : IBigObject {
}
public class DataWrapper<T> {
public T Data { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我希望能够传递一个DataWrapper<IObject>(可能是一些派生类)并作为一个项目获取IObject,并且我能够做到这一点的唯一方法就是这样:
IObject itemToAdd = null;
if (values[1] is IObject) {
itemToAdd = values[1] as IObject;
} else if (values[1] is DataWrapper<IObject>) {
itemToAdd = ((DataWrapper<IObject>)values[1]).Data;
} else if (values[1] is DataWrapper<IBigObject>) {
itemToAdd = ((DataWrapper<IBigObject>)values[1]).Data;
} else …Run Code Online (Sandbox Code Playgroud) asp.net ×5
c# ×4
.net ×2
ado.net ×1
css ×1
css3 ×1
foreign-keys ×1
html ×1
iis ×1
inheritance ×1
interface ×1
nullable ×1
paypal ×1
paypal-nvp ×1
powershell ×1
roleprovider ×1
svn ×1
vb.net ×1
windows ×1
winrar ×1