public async Task <IActionResult> Edit(long id, [Bind("Id,Type,InterfaceType,Name,Required,Direction,DontShow,Mask,Title,Comment,MinLength,MaxLength,RegExp,DontTicket")] ProviderField providerField) { if (id != providerField.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(providerField); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProviderFieldExists(providerField.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(providerField)); }
private IEnumerable <KeyValuePair <TemplateKey, ProviderField> > ExtractFromTypes(Assembly a) { if (!AssemblyInfo.GetAssemblyInfo(a).ScanForTemplates) { yield break; } foreach (TypeInfo type in a.GetTypesHelper()) { if (type.IsDefined(typeof(TemplatesAttribute))) { foreach (FieldInfo field in type.GetFields()) { if (!field.IsStatic) { continue; } if (typeof(ITemplate).IsAssignableFrom(field.FieldType)) { var fieldResult = new ProviderField(field); yield return(new KeyValuePair <TemplateKey, ProviderField>(fieldResult.Key, fieldResult)); } } } } }
public void ReadXElement_Empty_ThrowsSyncDocumentException() { ProviderField field = new ProviderField(); XElement element = XElement.Parse("<NotProviderField />"); field.ReadXElement(element); }
public void DefineProvider(QualifiedName name, Type providerType, FieldInfo field, object metadata = null) { if (providerType == null) { throw new ArgumentNullException("providerType"); } if (field == null) { throw new ArgumentNullException("field"); } if (!field.IsStatic || !providerType.IsAssignableFrom(field.FieldType)) { throw RuntimeFailure.InvalidProviderFieldOrMethod("field"); } var qn = GetName(name, field.DeclaringType, field.Name); var fieldResult = new ProviderField(field, providerType, qn); fieldResult.ProviderMetadata = ProviderMetadataWrapper.Create(metadata); fieldResult.ProviderMetadata.Source = fieldResult; AppendResult(fieldResult); }
public void GetXElement_SetType_ReturnsCorrectXml() { ProviderField field = new ProviderField(); field.Type = "System.Int32"; var element = field.GetXElement(); Assert.IsTrue(element.Attribute(ProviderField.CN_TYPE).Value == field.Type); }
public void GetXElement_SetName_ReturnsCorrectXml() { ProviderField field = new ProviderField(); field.Name = "name1"; var element = field.GetXElement(); Assert.IsTrue(element.Attribute(ProviderField.CN_NAME).Value == field.Name); }
public async Task <IActionResult> Create([Bind("Id,Type,InterfaceType,Name,Required,Direction,DontShow,Mask,Title,Comment,MinLength,MaxLength,RegExp,DontTicket")] ProviderField providerField) { if (ModelState.IsValid) { _context.Add(providerField); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(providerField)); }
public ITemplate GetTemplate(Type templateType, QualifiedName name) { if (templateType == null) { throw new ArgumentNullException(nameof(templateType)); } ProviderField f = _providers[new TemplateKey(templateType, name)]; if (f == null) { return(null); } return((ITemplate)f.GetValue()); }
public void PropertiesTest() { var vm = new ProviderField(); TestsHelper.TestPublicPropertiesGetSet(vm, null, true); }
public static ProviderField Convert(Cebos.Veyron.ESync.SyncDocument.ProviderField field) { var result = new ProviderField {Name = field.Name, Type = field.Type}; return result; }
public void DefineProvider(QualifiedName name, Type providerType, FieldInfo field, object metadata = null) { if (providerType == null) throw new ArgumentNullException("providerType"); if (field == null) throw new ArgumentNullException("field"); if (!field.IsStatic || !providerType.IsAssignableFrom(field.FieldType)) { throw RuntimeFailure.InvalidProviderFieldOrMethod("field"); } var qn = GetName(name, field.DeclaringType, field.Name); var fieldResult = new ProviderField(field, providerType, qn); fieldResult.Metadata = ProviderMetadataWrapper.Create(metadata); fieldResult.Metadata.Source = fieldResult; result.Add(fieldResult); }
public void ReadXElement_Empty_ThrowsArgumentNullException() { ProviderField field = new ProviderField(); XElement element = null; field.ReadXElement(element); }