Quantcast
Channel: DevNet Questions
Viewing all articles
Browse latest Browse all 8901

DataClassInfo System.NullReferenceException

$
0
0
Hi, I have created a .net core Console application to communicate with a kentico 13 MVC Application. I am trying to add a field to an existing Online Form / Biz Form. but when ever I Update the DataClassInfo object I get a System.NullReferenceException. I can pull data and update with other api components. I havent been able to get DataClassInfo to work correctly. I am not really sure what I am Missing. Code Example:DataClassInfo dci = DataClassInfoProvider.GetDataClassInfo(@FORM CLASS ID@); FormInfo fi = new FormInfo(dci.ClassFormDefinition); TableManager tm = new TableManager(null); // Create Table Manager Object FormFieldInfo field = new FormFieldInfo(); // New Form Field Object field.Name = @TEST@; field.Caption = @TEST@; field.AllowEmpty = true; field.System = false; field.Visible = true; field.Enabled = true; field.DataType = @nvarchar@; field.Size = 500; field.Settings.Add(@componentidentifier@, @Kentico.TextInput@); fi.AddFormItem(field); tm.AddTableColumn(dci.ClassTableName, field.Name, field.DataType + @(@ + field.Size + @)@, field.AllowEmpty, null); fi.UpdateExistingFields(fi); dci.ClassFormDefinition = fi.GetXmlDefinition(); dci.Update(); @------ Error Occurs Here //DataClassInfoProvider.SetDataClassInfo(dci); @------ Also occurs On Set Error: Exception Thrown - System.NullReferenceException: 'Object reference not set to an instance of an object.'

Viewing all articles
Browse latest Browse all 8901

Trending Articles