This project is read-only.

IFileStream and Windsor Castle

Jan 10, 2012 at 12:26 PM
Edited Jan 10, 2012 at 12:28 PM


I a bit puzzled about how to use IFileStream with Windsor::Castle....

Lets say I have a Class MyClass

    public class MyClass
        public IFileStream Filestream;

        public int LineCount(string filename)
            var res = 0;
            Filestream.Initialize(filename, FileMode.Open);
            using (var stream = Filestream.FileStreamInstance){
                // Do the counting
            return res;

My main, would be something like:
        public void main()
            var container = new WindsorContainer();

            var sut= container.Resolve<MyClass>();

            var res= sut.LineCount("whatever");

however when I resolve the MyClass I get a Missing Dependency error... 
it turns out that FileStreamWrap 
doesn't have an empty constructor, so I'll have to supply some kind of stream 
when registering IFIleStream

                .Eq(new MemoryStream()))

which seems rather clumpsy ... or am I missing something here....