/// <summary> /// Converts an <see cref="UserAssignedIdentity"/> object into a <see cref="JsonElement"/>. /// </summary> /// <param name="writer"> Utf8JsonWriter object to which the output is going to be written. </param> void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { if (writer == null) { throw new ArgumentNullException(nameof(writer)); } writer.WritePropertyName("principalId"); if (!Optional.IsDefined(PrincipalId)) { writer.WriteStringValue("null"); } else { writer.WriteStringValue(PrincipalId.ToString()); } writer.WritePropertyName("tenantId"); if (!Optional.IsDefined(TenantId)) { writer.WriteStringValue("null"); } else { writer.WriteStringValue(TenantId.ToString()); } writer.Flush(); }
public void PrincipalIdShouldDeserialize( string principalId ) { var source = $@"""PrincipalId={principalId}"""; var result = JsonSerializer.Deserialize <CloudFormationStackEvent>(source); result !.PrincipalId.Should().Be(principalId); }
public override int GetHashCode( ) { unchecked { int res = _Resource.Key.GetHashCode( ); res = res * 17 + PrincipalId.GetHashCode( ); res = res * 17 + OperationId.GetHashCode( ); res = res * 17 + AccessPredicateType.GetHashCode( ); return(res); } }
public override void Validate() { base.Validate(); ScheduleId.HasValue("时间节点编码不能为空").MaxLength(50, "时间节点编码限制长度50"); ScheduleName.HasValue("时间节点不能为空").MaxLength(50, "时间节点限制长度50"); ProjectId.HasValue("项目编码不能为空").MaxLength(50, "项目编码限制长度50"); Summary.HasValue("问题摘要不能为空").MaxLength(50, "问题摘要限制长度200"); //Detail.HasValue("问题详情不能为空").MaxLength(50, "问题详情限制长度200"); CreateName.HasValue("创建人不能为空").MaxLength(50, "创建人限制长度50"); PrincipalId.HasValue("负责人编码不能为空").MaxLength(50, "负责人编码限制长度50"); PrincipalName.HasValue("负责人不能为空").MaxLength(50, "负责人限制长度50"); }
/// <summary> /// Converts an <see cref="UserAssignedIdentity"/> object into a <see cref="JsonElement"/>. /// </summary> /// <param name="writer"> Utf8JsonWriter object to which the output is going to be written. </param> void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { if (writer == null) { throw new ArgumentNullException(nameof(writer)); } writer.WriteStartObject(); writer.WritePropertyName("clientId"); writer.WriteStringValue(ClientId.ToString()); writer.WritePropertyName("principalId"); writer.WriteStringValue(PrincipalId.ToString()); writer.WriteEndObject(); writer.Flush(); }
private string PrincipalToString() { return(PrincipalId == -1 ? "" : PrincipalId.ToString()); }