private MobeelizerModelDefinition ParseModel(XElement model) { MobeelizerModelDefinition modelDef = new MobeelizerModelDefinition(); modelDef.Name = model.Attribute(MobeelizerDefinitionTag.NAME_TAG).Value; XElement fields = model.Element(XName.Get(MobeelizerDefinitionTag.FIELDS_TAG, MobeelizerDefinitionTag.NAMESPACE)); if (fields != null) { modelDef.Fields = new List <MobeelizerModelFieldDefinition>(); foreach (XElement field in fields.Elements(XName.Get(MobeelizerDefinitionTag.FIELD_TAG, MobeelizerDefinitionTag.NAMESPACE))) { modelDef.Fields.Add(ParseField(field)); } } XElement credentials = model.Element(XName.Get(MobeelizerDefinitionTag.CREDENTIALS_TAG, MobeelizerDefinitionTag.NAMESPACE)); modelDef.Credentials = new List <MobeelizerModelCredentialsDefinition>(); foreach (XElement credential in credentials.Elements(XName.Get(MobeelizerDefinitionTag.CREDENTIAL_TAG, MobeelizerDefinitionTag.NAMESPACE))) { modelDef.Credentials.Add(ParseModelCredentials(credential)); } return(modelDef); }
private Type FindType(MobeelizerModelDefinition radModel, string entityPackage) { String typeFullName = entityPackage.Replace(",", String.Format(".{0},", radModel.Name)); Type type = null; try { type = Type.GetType(typeFullName); } catch (ArgumentException e) { throw new InvalidOperationException(e.Message, e); } return type; }
private Type FindType(MobeelizerModelDefinition radModel, string entityPackage) { String typeFullName = entityPackage.Replace(",", String.Format(".{0},", radModel.Name)); Type type = null; try { type = Type.GetType(typeFullName); } catch (ArgumentException e) { throw new InvalidOperationException(e.Message, e); } return(type); }
private MobeelizerModelCredentialsDefinition HasAccess(MobeelizerModelDefinition model, string role) { foreach (MobeelizerModelCredentialsDefinition credentials in model.Credentials) { if (credentials.Role.Equals(role)) { if (credentials.CreateAllowed != MobeelizerCredential.NONE || credentials.UpdateAllowed != MobeelizerCredential.NONE || credentials.ReadAllowed != MobeelizerCredential.NONE || credentials.DeleteAllowed != MobeelizerCredential.NONE) { return(credentials); } break; } } return(null); }
private MobeelizerModelDefinition ParseModel(XElement model) { MobeelizerModelDefinition modelDef = new MobeelizerModelDefinition(); modelDef.Name = model.Attribute(MobeelizerDefinitionTag.NAME_TAG).Value; XElement fields = model.Element(XName.Get(MobeelizerDefinitionTag.FIELDS_TAG, MobeelizerDefinitionTag.NAMESPACE)); if (fields != null) { modelDef.Fields = new List<MobeelizerModelFieldDefinition>(); foreach (XElement field in fields.Elements(XName.Get(MobeelizerDefinitionTag.FIELD_TAG, MobeelizerDefinitionTag.NAMESPACE))) { modelDef.Fields.Add(ParseField(field)); } } XElement credentials = model.Element(XName.Get(MobeelizerDefinitionTag.CREDENTIALS_TAG, MobeelizerDefinitionTag.NAMESPACE)); modelDef.Credentials = new List<MobeelizerModelCredentialsDefinition>(); foreach (XElement credential in credentials.Elements(XName.Get(MobeelizerDefinitionTag.CREDENTIAL_TAG, MobeelizerDefinitionTag.NAMESPACE))) { modelDef.Credentials.Add(ParseModelCredentials(credential)); } return modelDef; }
private MobeelizerModelCredentialsDefinition HasAccess(MobeelizerModelDefinition model, string role) { foreach (MobeelizerModelCredentialsDefinition credentials in model.Credentials) { if (credentials.Role.Equals(role)) { if (credentials.CreateAllowed != MobeelizerCredential.NONE || credentials.UpdateAllowed != MobeelizerCredential.NONE || credentials.ReadAllowed != MobeelizerCredential.NONE || credentials.DeleteAllowed != MobeelizerCredential.NONE) { return credentials; } break; } } return null; }