-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMensaje.cs
38 lines (30 loc) · 1.04 KB
/
Mensaje.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using MongoDB.Bson;
using MongoDB.Bson.Serialization.Attributes;
namespace LiveChat
{
public class Mensaje
{
[BsonId]
[BsonRepresentation(BsonType.ObjectId)] // Mongo me genera automáticamente el id
public ObjectId Id { get; set; }
[BsonElement("idConversacion")]
public string IdConversacion { get; set; }
[BsonElement("emisor")]
public string Emisor { get; set; }
[BsonElement("receptor")]
public string Receptor { get; set; }
[BsonElement("texto")]
public string Texto { get; set; }
[BsonElement("fecha")]
[BsonRepresentation(BsonType.DateTime)] // Para que se guarde como DateTime en MongoDB
public DateTime Fecha { get; set; }
public Mensaje(string idConversacion, string emisor, string receptor, string texto, DateTime fecha)
{
IdConversacion = idConversacion;
Emisor = emisor;
Receptor = receptor;
Texto = texto;
Fecha = fecha;
}
}
}