Port from v1.2005 to v2 - dynamic collection validation

Posts   
 
    
Posts: 14
Joined: 06-Feb-2007
# Posted on: 02-Jul-2007 17:32:26   

Hi,

I have this

public EnumCollection(Type type)
        {
            m_type = type;
            bool isOk = true;

            string nameType = m_type.Name == "D" ? "Dictionary" : m_type.Name; // D is alias for Dictionary
            string nameTypeEntity = "Dipica.BM.DAL.EntityClasses." + nameType + "Entity";
            string nameTypeCollection = "Dipica.BM.DAL.CollectionClasses." + nameType + "Collection";

            m_error = nameTypeCollection + ": " + Environment.NewLine;

            Type refTypeEntity = typeof(Dipica.BM.DAL.EntityClasses.MutationEntity); // any class will do
            Type refTypeCollection = typeof(Dipica.BM.DAL.CollectionClasses.MutationCollection); // any class will do

            Type typeEntity = refTypeEntity.Assembly.GetType(nameTypeEntity);
            Type typeCollection = refTypeCollection.Assembly.GetType(nameTypeCollection);

            EntityCollectionBase collection = (EntityCollectionBase)Activator.CreateInstance(typeCollection);
            collection.GetMulti(null, 0, null, null, 0, 0); // TODO ok ???

            if (Enum.GetValues(m_type).Length != collection.Count + 1)
            {// + 1 for <undefined> 
                isOk = false;
                m_error += "enum count (" + Enum.GetValues(m_type).Length.ToString() +
                ") <> database count (" + (collection.Count + 1).ToString() + ")" + Environment.NewLine;
            }
....
}

piece of code.

How can I run this in v2? Is there a way to instantiate these collections? I can't figure it out :s

Thanks in advance!

Koen

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 03-Jul-2007 06:16:19   

Please review LLBLGenPro Help - Migrating your code. However I don't see any breaking change applied to your code. Start testing your code in v2 and see what happen, maybe you only need to fix some typos simple_smile

David Elizondo | LLBLGen Support Team
Posts: 14
Joined: 06-Feb-2007
# Posted on: 03-Jul-2007 12:44:04   

Hi,

I did review it before. But I was struggling with the EntityCollectionBase<> Replacing that with IEntityCollection and just looping through the collection basically solved my problem. Last hurdle towards migration taken... yay simple_smile

Thanks,

Koen