} // end saveSourceType /// <summary> /// Given a handle to the server, creates a type in the database based /// on this data type. /// </summary> /// <param name="kinetica">The handle to the database server.</param> /// <returns>The ID with which the database identifies this type.</returns> public string create(Kinetica kinetica) { // Save the association between this KineticaType's source and itself in the Kinetica object // for future reference (it helps with encoding and decoding records) if (this.m_data.sourceType != null) { kinetica.SetKineticaSourceClassToTypeMapping(this.m_data.sourceType, this); } // Register the type with Kinetica CreateTypeResponse response = kinetica.createType(m_data.schemaString, m_data.label, m_properties); return(response.type_id); } // end create()
public CreateTypeResponse Create(CreateTypeRequest request) { var response = new CreateTypeResponse(); try { var type = request.MapTo<Data.Entities.Type>(); DataContext.Types.Add(type); DataContext.SaveChanges(); response.IsSuccess = true; response.Message = "KPI type item has been added successfully"; } catch (DbUpdateException dbUpdateException) { response.Message = dbUpdateException.Message; } return response; }
/// <summary> /// Unmarshaller the response from the service to the response class. /// </summary> /// <param name="context"></param> /// <returns></returns> public override AmazonWebServiceResponse Unmarshall(JsonUnmarshallerContext context) { CreateTypeResponse response = new CreateTypeResponse(); context.Read(); int targetDepth = context.CurrentDepth; while (context.ReadAtDepth(targetDepth)) { if (context.TestExpression("type", targetDepth)) { var unmarshaller = TypeUnmarshaller.Instance; response.Type = unmarshaller.Unmarshall(context); continue; } } return(response); }
public CreateTypeResponse Create(CreateTypeRequest request) { var response = new CreateTypeResponse(); try { var type = request.MapTo <Data.Entities.Type>(); DataContext.Types.Add(type); DataContext.SaveChanges(); response.IsSuccess = true; response.Message = "KPI type item has been added successfully"; } catch (DbUpdateException dbUpdateException) { response.Message = dbUpdateException.Message; } return(response); }