Пример #1
0
        public static List <Temp> GetMetaData(this SystemUser entityObject)
        {
            XERP.Server.DAL.LogInDAL.DALUtility dalUtility = new DALUtility();
            List <Temp> tempList = new List <Temp>();
            int         id       = 0;

            using (LogInEntities ctx = new LogInEntities(dalUtility.EntityConectionString))
            {
                var c            = ctx.SystemUsers.FirstOrDefault();
                var queryResults = from meta in ctx.MetadataWorkspace.GetItems(DataSpace.CSpace)
                                   .Where(m => m.BuiltInTypeKind == BuiltInTypeKind.EntityType)
                                   from query in (meta as EntityType).Properties
                                   .Where(p => p.DeclaringType.Name == entityObject.GetType().Name

                                          && p.TypeUsage.EdmType.Name == "String")
                                   select query;

                if (queryResults.Count() > 0)
                {
                    foreach (var queryResult in queryResults.ToList())
                    {
                        Temp temp = new Temp();
                        temp.ID     = id;
                        temp.Name   = queryResult.Name.ToString();
                        temp.Int_1  = Convert.ToInt32(queryResult.TypeUsage.Facets["MaxLength"].Value);
                        temp.Bool_1 = false; //we use this as a error trigger false = not an error...
                        tempList.Add(temp);
                        id++;
                    }
                }
            }
            return(tempList);
        }
Пример #2
0
        public LogInServiceAgent()
        {
            ServiceUtility serviceUtility = new ServiceUtility();

            _rootUri = _serviceUtility.BaseUri;
            //this context will be used for read only gets...
            _context = new LogInEntities(_rootUri);
        }