public StructureType CreateStructureType(StructureType new_structureType) { try { DBStructureType db_obj = new DBStructureType(); //Create the object to get the ID new_structureType.Sync(db_obj); db.DBStructureTypes.InsertOnSubmit(db_obj); db.Log = Console.Out; db.SubmitChanges(); Console.Out.Flush(); StructureType output_obj = new StructureType(db_obj); return output_obj; } finally { if (db != null) db.Connection.Close(); } return null; }