private static extern int psoFolderCreateObject( IntPtr folderHandle, string objectName, UInt32 nameLengthInBytes, ref ObjectDefinition pDefinition, ref KeyDefinition pKey, FieldDefinition [] pFields);
static void Main(string[] args) { Process proc = new Process(); BasicObjectDef definition = new BasicObjectDef(); FieldDefinition[] fields = new FieldDefinition[1]; try { proc.Init("10701", false); } catch(PhotonException e) { Console.WriteLine(e.ToString()); Console.WriteLine("Init"); Environment.Exit(e.ErrorCode()); } int rc = 0; Console.WriteLine("Init" + rc); Session sess = new Session(); definition.type = ObjectType.FOLDER; sess.CreateObject("/Test", ref definition, fields); sess.Commit(); ObjStatus status = new ObjStatus(); sess.GetStatus("/Test", ref status); }
private static extern int psoCreateObject( IntPtr sessionHandle, string objectName, UInt32 nameLengthInBytes, ref ObjectDefinition definition, ref KeyDefinition key, FieldDefinition[] fields);
// --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-- public void CreateObject( String objectName, ref ObjectDefinition definition, ref KeyDefinition key, FieldDefinition[] fields) { int rc; if (handle == (IntPtr)0) { rc = (int)PhotonErrors.NULL_HANDLE; throw new PhotonException(PhotonException.PrepareException("Session.DestroyObject", rc), rc); } rc = psoCreateObject(handle, objectName, (UInt32)objectName.Length, ref definition, ref key, fields ); if (rc != 0) { throw new PhotonException(PhotonException.PrepareException(handle, "Session.DestroyObject"), rc); } }
// --+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+-- public void CreateObject(String objectName, ref ObjectDefinition pDefinition, ref KeyDefinition pKey, FieldDefinition [] pFields) { int rc; if (handle == (IntPtr)0) { rc = (int)PhotonErrors.NULL_HANDLE; throw new PhotonException(PhotonException.PrepareException("Folder.CreateObject", rc), rc); } rc = psoFolderCreateObject(handle, objectName, (UInt32)objectName.Length, ref pDefinition, ref pKey, pFields ); if (rc != 0) { throw new PhotonException(PhotonException.PrepareException(sessionHandle, "Folder.CreateObject"), rc); } }