首先使用代码创建一个网站,对于我自己的想法,我希望能够在您首先使用数据库并在VS2010中创建SQL服务器数据库时探索它创建的数据库.
我已经浏览了一下,我能找到的唯一相关信息似乎是先使用以前存在的db代码,我希望db首先由代码生成,我只是想知道它在哪里,或者如何更改它的默认位置,以便我可以查看它.
我在配置文件中有一个连接字符串的小提琴,但不知道我在做什么,所以没有在那里取得任何成功.它与custon连接字符串工作正常,但我仍然不知道db文件在哪里!
鉴于:
public interface IFeedOperations : IOperationsWithPreInstalledData
{
...
}
public class FeedOperations : IFeedOperations
{
}
Run Code Online (Sandbox Code Playgroud)
如何将RegisterType用于实现IFeedOperationsAND 的类,因此也是IOperationsWithPreInstalledData如此?
public class FeedsInstaller : IDependencyInstaller
{
public void Install(IDependencyContainer container)
{
container.RegisterType(typeof(IFeedOperations), typeof(FeedOperations));
container.RegisterType(typeof(IOperationsWithPreInstalledData), typeof(FeedOperations));
}
}
Run Code Online (Sandbox Code Playgroud)
当前代码产生以下错误.如果我删除第二个RegisterType,那么当我打电话时,我得不到任何结果container.ResolveAll<IOperationsWithPreInstalledData>().
组件... Feeds.FeedOperations无法注册.已有一个具有该名称的组件.您想要修改现有组件吗?如果没有,请确保指定唯一名称.
如果我删除第二个RegisterType,那么当我打电话时,我得不到任何结果container.ResolveAll<IOperationsWithPreInstalledData>().Castle Windsor似乎没有看到实现的类IFeedOperations也实现了IOperationsWithPreInstalledData.
如何在Castle Windsor中注册我的实现类,以便它知道我的类实现了两个接口 - 或者说我的类可以解析任何一个接口.
这工作:
//delegate
Parallel.For(1023456789, 1033456789, delegate(long i)
{
if (i % 10000000 == 0) Console.WriteLine("{0:N0}", i);
if (IsPanDigital(i))
{
list.Add(i);
}
}
);
//lambda expression
Parallel.For(1023456789, 1033456789, i =>
{
if (i%10000000 == 0) Console.WriteLine("{0:N0}", i);
if (IsPanDigital(i))
{
list.Add(i);
}
}
);
Run Code Online (Sandbox Code Playgroud)
是否可以使用Func重写此逻辑?我在这里试过..不编译.
var list = new List<long>();
Parallel.For(1023456789, 1033456789, Blah(i, ref list));
public static Func<long> Blah(long i, ref List<long> list)
{
if (i % 10000000 == 0) Console.WriteLine("{0:N0}", i);
if (IsPanDigital(i))
{
list.Add(i);
}
}
Run Code Online (Sandbox Code Playgroud)
我试图看看它是否可以完成.
为什么这段代码会导致shipment.Items.Count和combinedShipment.Items.Count等于零?
private static InboundShipment CombineLikeIsbns(InboundShipment shipment)
{
// shipment.Items has a count of 3
var distinctIsbns = shipment.Items.Select(i => i.ISBN).Distinct().ToList();
var combinedShipment = shipment;
combinedShipment.Items = new List<InboundShipmentItem>();
// Now both combinedShipment and shipment have an empty List in the .Items property
...
return combinedShipment;
}
Run Code Online (Sandbox Code Playgroud)
[编辑]当我将combinedShipment.Items设置为相同时,我该怎么做以避免出货.物品设置为新列表?