Hey all,

I wonder if anyone has meat same problem I did:

When I'm trying to select joining 3 tables, ASP.NET throws an
exception somewhere in  Linq's expression.
So I decided to move that logic into Mysql stored procedure, which
returns to DBLinq DataSet and the problem I meat is to cast DataRow to
my table entity. I've used little bit of reflection to solve this
problem, but not sure it's best solution.

        protected static Object initiateFromDataRow(DataRow row,Type
type)
        {
            Object res = type.GetConstructor(new Type[] { }).Invoke
(null);
            PropertyInfo[] infos = type.GetProperties();
            foreach (PropertyInfo info in infos)
            {
                if ((info.GetCustomAttributes(typeof(ColumnAttribute),
true)).Count() > 0)
                    info.SetValue(res, row[info.Name], null);
            }
            return res;
        }

Any comments?

Thank you in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DbLinq" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/dblinq?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to