Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

genric method to loop through entities replacement for Data Row???

$
0
0
I have an old function that we used for lookup tables I need some help with it converting it to entity framework. i no i need to use something like type entitytype to get access to the entities columns but i am at a aloos to what next


        public int GetCode(string value, Type entityType, string nextnoType)
        {
            int code = 0;
            //DataRow[] lookupRecord = lookup.Select(string.Format("desc_ = '{0}'", value.Replace("'", "''")));
            //if (lookupRecord.Length > 0)
            //    code = (int)lookupRecord[0]["code"];
            //else
            //{
            //    DataRow newLookup = lookup.NewRow();
            //    newLookup["code"] = context.GetNextId(nextnoType);
            //    newLookup["desc_"] = value;
            //    lookup.Rows.Add(newLookup);
            //    code = (int)newLookup["code"];
            //}
            return code;
        }

Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>