小编Rub*_*ink的帖子

c#,MSBuild Bootstrapper with wix,如何下载.net framework 3.5 SP1?

我设法为我的项目创建了bootstrapper,其中包含带有此代码的.net framework 3.5SP1:

  <ItemGroup>  
    <BootstrapperFile Include="Microsoft.Net.Framework.3.5.SP1">  
        <Visible>False</Visible>  
        <ProductName>.NET Framework 3.5.SP1</ProductName>  
        <Install>true</Install>  
      </BootstrapperFile>        
    </ItemGroup>  
    <Target Name="Bootstrapper">  
      <GenerateBootstrapper  
        ApplicationFile="SeppelSetup.msi"  
        ApplicationName="Seppel 1.0"  
        BootstrapperItems="@(BootstrapperFile)"  
        OutputPath=".\bin\Debug"  
        ComponentsLocation="Relative"  
        Culture="en"  
        Path="C:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\Bootstrapper"  
      />  
    </Target>
Run Code Online (Sandbox Code Playgroud)

问题是输出目录已超过200Mb,这远远超出我的承受能力(我想将安装程序联机下载).有没有办法允许我从microsoft的网站下载框架,而不是在安装包中包含所有文件?

c# msbuild bootstrapping wix

5
推荐指数
1
解决办法
1814
查看次数

使用TeamCity的Tomcat来托管其他应用程序?

使用TeamCity附带的Tomcat servlet容器来托管其他WAR应用程序是否明智?

如果是这样,是否有建议的方法在升级TeamCity方面做了特别的事情?

teamcity tomcat

5
推荐指数
1
解决办法
316
查看次数

棱镜复合材料应用 - 可混合性

我们使用的是Prism,是一个很好的组合和模块化框架.然而,我还没有看到关于Blendability with Prism组合的好故事.当你有一个包含Regions的代码时,你通常如何支持它的可混合性?

我看到一篇有趣的博客文章,它采用创建设计时引导程序,模块目录,容器的方法来支持这一点.

你有什么经历?PnP团队是否会围绕它提出更好的故事?(也就是说可能嵌入设计时间的bootstrapper,设计师时间区域经理在Prism里面)?

我正在尝试使用Ninject为模块化Silverlight应用程序工作.我可以尝试按照上面的链接并使其工作,但我想看看有人有更好的想法吗?

prism ninject silverlight-4.0 prism-4

5
推荐指数
1
解决办法
415
查看次数

DLL的入口点

我有一个c# .net WPF应用程序,现在我需要注册NInject IoC已经BLLDAL层使用的东西(基本上是模式的内核).

我想知道入口点或类似的东西dll,我可以放置该代码(内核注册).

对于WPF部分,我使用App.xaml.cs,对于WCF我使用的部分,Global.asax.cs因为它们是这些东西的切入点.但是独立的dlls是什么,他们的切入点是什么.

一种方法是,我可以在我的dll中添加一个静态类来实现这个目的,并从app.xaml.cs我调用BLL的这个方法并注册我的内核.但这似乎更像是一种解决方法而非方法.

请指导我一些更重要的事情和逻辑.

.net c# wpf wcf ninject

5
推荐指数
1
解决办法
517
查看次数

Ninject:实现WithConstructorArgument(字符串名称,Func <IContext,object>回调)

我有一个MVVM WP7应用程序,我正在尝试将一个页面/ ViewModel中的值发送到第二个ViewModel的构造函数.我已经安装了Ninject,并使用以下行来使用静态测试值:

this.Bind<TaskViewModel>().ToSelf().WithConstructorArgument("TaskID", 2690)
Run Code Online (Sandbox Code Playgroud)

同样,它使用静态值,但我需要它是用户选择的变量.我被告知要使用过载

WithConstructorArgument(string name, Func<IContext,object> callback). 
Run Code Online (Sandbox Code Playgroud)

我认为这个回调会在第一个ViewModel上调用一个函数并获取值.

但我没有成功,很容易承认我在Ninject或使用Func回调参数方面不是很有经验.我已经尝试设置一个委托和函数来从第一个ViewModel获取值,但是这给出了一个错误,说我正在尝试传入一个类型.我究竟如何指定使用回调的参数,我是否正确使用第一个ViewModel中的委托或其他东西?

c# ninject

5
推荐指数
1
解决办法
2337
查看次数

依赖注入:使用多项目解决方案时如何注入

希望这个问题不是太愚蠢,我试图掌握更高级的编程原则,因此试图习惯使用Ninject进行依赖注入.

所以,我的模型被分成几个不同的.dll项目.一个项目定义了模型规范(Interfaces),其他一些项目实现了这些接口.所有模型项目都需要使用某种数据库系统,因此它们都需要访问另一个实现我所有数据库逻辑的.dll.但重要的是,所有这些都可以访问我的数据库对象的同一个实例,因此,如果仅为每个模型创建一个实例是不够的.

不过,我不太确定如何使用依赖注入来实现这一点.我的第一个想法是创建一个单独的DI项目并将所有接口绑定到它们各自的实现,因此DI项目需要引用所有其他项目(模型接口和实现,数据库系统等).然后,模型将需要访问DI项目,因为例如,他们需要从DI系统(Ninject)请求数据库系统.当然这会创建一个循环引用(将DI项目绑定到DI项目的模型和模型),所以这是不可能的.

长话短说,我需要一个编程模式,让我的模型接口绑定到他们的实现,但也允许模型的实现要求从Ninject,如其他依赖

IModel1 -> Model1
IModel2 -> Model2 (different project)
IDatabase -> Database (different project)
Model1 -> request IDatabase -> get Database instance
Model2 -> request IDatabase -> get the same Database instance
Run Code Online (Sandbox Code Playgroud)

很高兴得到一些建议,目前我被困住了,并且没有想法;)谢谢!

dependency-injection ninject

5
推荐指数
2
解决办法
2284
查看次数

使用WCF和Autofac的自定义端点行为

我正在尝试实现如下所示的UoW:http://blog.iannelson.systems/wcf-global-exception-handling/

但我不能为我的生活弄清楚如何用Autofac连接它.我完全不知道从哪里开始.

使用http://autofac.readthedocs.org/en/latest/integration/wcf.html我使用Autofac让WCF正常工作

但要注入或添加IEndpointBehavior?不知道...

如果有更好的方法来实现UoW,我想听听.

编辑:

现在我刚刚完成了:

builder.RegisterType(typeof (UnitOfWork))
    .As(typeof (IUnitOfWork))
    .InstancePerLifetimeScope()
    .OnRelease(x =>
    {
        Trace.WriteLine("Comitted of UoW");
        ((IUnitOfWork) x).Commit();
        // OnRelease inhibits the default Autofac Auto-Dispose behavior so explicitly chain to it
        x.Dispose(); 
    });
Run Code Online (Sandbox Code Playgroud)

虽然我不知道这是否是一种可以接受的方式,但看起来像是黑客:(

EDIT2:

似乎不可能在WCF中运行UoW:/

编辑3:

我在这里发布了我的解决方案:http://www.philliphaydon.com/2011/11/06/unit-of-work-with-wcf-and-autofac/

wcf unit-of-work autofac endpointbehavior

5
推荐指数
1
解决办法
1490
查看次数

使用NInject时,在注入a a ctor arg时解析IEnumerable <T>会失败,但在执行Get <IEnumerable <T >>()时则不会

当我为IEnumerable设置绑定时使用NInject时,如果我直接请求IEnumerable,它将起作用,但如果另一个绑定对象需要IEnumerable则不行.这是设计的吗?

class Program {
    static void Main(string[] args){
        var k = new StandardKernel();
        k.Bind<IEnumerable<int>>().ToMethod(GetInts);
        k.Bind<IFoo>().To<Foo>(); //Has an IEnumberable<int> constructor arg
        var works = k.Get<IEnumerable<int>>(); //returns the array of ints
        var tst = k.Get<IFoo>(); //Empty integer array is passed in by ninject???
        tst.Get(); //returns an empty integer array????
        return;
    }

    public static int[] GetInts(IContext ctx){
        return new int[] {1,2,3,4,5};
    }
}


public interface IFoo{
    IEnumerable<int> Get();
}


public class Foo : IFoo{
    private int[] _vals;

    public Foo(IEnumerable<int> vals){
        _vals = vals.ToArray(); …
Run Code Online (Sandbox Code Playgroud)

c# dependency-injection ninject

5
推荐指数
1
解决办法
983
查看次数

如何在xunit/autofixture中组合PropertyData和AutoNSubstituteData属性?

我正在使用[AutoNSubstituteData]这里发布的属性:

AutoFixture,xUnit.net和Auto Mocking

我想将它与[PropertyData("")]xunit扩展的属性结合起来.

这是我的测试:

public static IEnumerable<string[]> InvalidInvariant
{
    get
    {
        yield return new string[] { null };
        yield return new [] { string.Empty };
        yield return new [] { " " };
    }
}

[Theory, AutoNSubstituteData, PropertyData("InvalidInvariant")]
public void TestThatGuardsAreTriggeredWhenConnectionStringArgumentIsInvalid(
    IDeal deal,
    IDbConnection conn,
    IDb db,
    ISender sender,
    string invalidConnString,
    string query)
{
    deal.Init.Group.Returns(Group.A);
    deal.Aggr.Group.Returns(Group.A);
    deal.Product.Commodity.Returns(Product.Commodity.E);

    var sut = new Handler(db, sender);
    Assert.Throws<ArgumentException>(() => 
        sut.HandleDeal(deal, conn, invalidConnString, query));
}
Run Code Online (Sandbox Code Playgroud)

有没有办法组合这些属性或获得所需的功能(模拟一切,除了invalidConnstring,应该填充属性数据)?

unit-testing mocking xunit.net autofixture nsubstitute

5
推荐指数
2
解决办法
2304
查看次数

在 F# Interactive 上运行 F# 测试

我倾向于在 F# 脚本文件上编写一些关于算法的快速原型(我真的不打算稍后迁移到.fs文件中,尽管这很有可能)并且我想轻松地测试它们。在通过 F# Interactive 运行时,在 F# 中进行一些真正的NUnit/FsUnit 测试的最快方法是什么?

好吧,只要不给我带来任何额外的麻烦,在 Visual Studio 的 Test Runner 中运行它们就会很棒,我希望 KISSest 解决方案成为可能!

f# unit-testing visual-studio f#-interactive

5
推荐指数
1
解决办法
765
查看次数