I have a delimited file that I'm parsing to create new fields. However, there doesn't appear to be a close or dispose method on the LFTemplateField object. When I call the Create method the second time, I get an error. So I wrote some code where I call into a function to create each field. This seems to work, but doesn't strike me as the correct approach. Here's the code block I'm using to test the concept.
private void btnCreateFields_Click(object sender, EventArgs e) { LfApp = new LFApplication(); LfServ = (LFServer)LfApp.GetServerByName("127.0.0.1"); LfDB = LfServ.GetDatabaseByName("Repository"); LfConn = new LFConnection(); LfConn.UserName = ""; LfConn.Password = ""; LfConn.Create(LfDB); LFTemplate NewTemp = new LFTemplate(); NewTemp.Create(LfDB, "CFOAdmin", true); for (int i = 1; i < 21; i++) { CreateField(NewTemp, i); } } private void CreateField(LFTemplate Temp, int count) { LFTemplateField NewField = new LFTemplateField(); NewField.Create(LfDB, "Field " + count.ToString(), Field_Type.FIELD_TYPE_STRING, false); NewField.Update(); Temp.AddTemplateField(count, NewField); Temp.Update(); }