/// <summary> /// This method need for reading json and convert to c# object /// </summary> /// <param name="reader"></param> /// <param name="typeToConvert"></param> /// <param name="options"></param> /// <returns></returns> public override int Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { var directionName = reader.GetString(); using var context = new DIMSCoreContext(); var direction = context.Directions.FirstOrDefault(x => x.Name == directionName); return(direction?.DirectionId ?? 0); }
/// <summary> /// This method need for reading c# object and convert to json /// </summary> /// <param name="writer"></param> /// <param name="value"></param> /// <param name="options"></param> public override void Write(Utf8JsonWriter writer, int value, JsonSerializerOptions options) { var directionId = value; using var context = new DIMSCoreContext(); var direction = context.Directions.FirstOrDefault(x => x.DirectionId == directionId); if (direction != null) { writer.WriteStringValue(direction.Name); } else { writer.WriteNullValue(); } }
protected BaseRepositoryFixture() { Context = ContextCreator.CreateContext(); InitDatabase(); }
public TaskRepository(DIMSCoreContext context) : base(context) { }
public VTaskRepository(DIMSCoreContext context) { _context = context; }
public UnitOfWork(DIMSCoreContext context) { _context = context; }
public VUserTrackRepository(DIMSCoreContext context) : base(context) { }
public UserProfileRepository(DIMSCoreContext context) : base(context) { }
public DirectionRepository(DIMSCoreContext context) : base(context) { }
protected ReadOnlyRepository(DIMSCoreContext context) { _context = context; }
public VUserProgressRepository(DIMSCoreContext context) : base(context) { }
public VUserProfileRepository(DIMSCoreContext context) { _context = context; }