Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get Factory definitions from a namespace or an assembly #2

Open
lgcrespo opened this issue Apr 2, 2012 · 2 comments
Open

Get Factory definitions from a namespace or an assembly #2

lgcrespo opened this issue Apr 2, 2012 · 2 comments

Comments

@lgcrespo
Copy link

lgcrespo commented Apr 2, 2012

I know that in the real ruby version, you just call FactoryGirl define method anywhere in a file and that adds the factory and makes it ready to be used.

However, given that in .NET we need to have a class to put code inside, that technique suggests to have a static class with the factory definitions inside a constructor perhaps or have some group of classes that contain inside a group of factory definitions.

Perhaps it could be useful to have a method like FactoryGirl.AddDefinitionsFromNamespace() or FactoryGirl.AddDefinitionsFromAssembly() and a group of methods like that, and define some interface to register factories, like:

public interface IFactoryDefinition<T>{
    public Func Define();
}

or something like that. What do you think?

@leoasis
Copy link

leoasis commented Apr 2, 2012

Sorry just posted using my other user, this is my personal one

@JamesKovacs
Copy link
Owner

In the past, I've just explicitly called some static helper methods in a test assembly startup class. I could see something like this being useful in a larger project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants