سؤال

I'm new to ValueInjecter, I've used it for a week from a sample app. Now this is the code I'm trying using

    public virtual TInput MapToInput(TEntity entity)
    {
        var input = new TInput();
        input.InjectFrom(entity)
            .InjectFrom<NormalToNullables>(entity)
            .InjectFrom<EntitiesToInts>(entity);
        return input;
    }

It was working fine but now all of sudden, input.InjectFrom seems to taking too much time. I'm not quite sure what I messing up here. Can anybody advice thanks in advance.

Update: e.InjectFrom(input)

this is the line thats taking too much time. I've a Status Type and there are more than 10,000 employee records associated to the POCO instanace... I'm using Mapper hoping to map Status only but for some reason its parsing the whole graph. Is there anyone who can tell how to avoid it? my input only has Status fields and doesn't even contain any child list but still Mapper isn't convinced and parse the whole POCO for more than couple of minutes now.

هل كانت مفيدة؟

المحلول

according to injection name "IdsToTypeIds" I suppose that it goes into the DB and pulls data, something like Repo.Get<Type>(Id)

if you don't want to traverse some properties you can specify this rule in the Match method

and also injections can receive parameters in the constructor, in case you need any

anyway, the fastest way is to use the SmartConventionInjection and this is what I recommend you to do

just copy it in your solution and use it as you would use the ConventionInjection

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top