{"id":1709,"date":"2014-12-16T19:05:14","date_gmt":"2014-12-16T19:05:13","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=1709"},"modified":"2014-12-16T19:05:14","modified_gmt":"2014-12-16T19:05:13","slug":"moving-no-schema-stack-c-and-dynamic-types","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/es\/moving-no-schema-stack-c-and-dynamic-types\/","title":{"rendered":"Mover ning\u00fan esquema hacia arriba con C# y tipos din\u00e1micos"},"content":{"rendered":"<p>Uno de los beneficios significativos de trabajar con Couchbase Server 2.0 es su esquema flexible.  Los documentos se almacenan como JSON, permitiendo registros impl\u00edcitamente estructurados que no imponen ning\u00fan orden entre s\u00ed.  En el mundo real, esa \"estructura impl\u00edcita\" proviene de tu aplicaci\u00f3n.  Cuando creas un nuevo usuario en tu aplicaci\u00f3n, el documento asociado es una versi\u00f3n serializada en JSON de tu objeto de dominio.<\/p>\n<div class=\"geshifilter\">\n<div class=\"javascript geshifilter-javascript\" style=\"font-family:monospace;\"><span style=\"color: #003366; font-weight: bold;\">p\u00fablico<\/span> <span style=\"color: #003366; font-weight: bold;\">clase<\/span> Usuario<br \/><span style=\"color: #009900;\">{<\/span><br \/>\u00a0 \u00a0 <span style=\"color: #009900;\">[<\/span>JsonIgnore<span style=\"color: #009900;\">]<\/span><br \/>\u00a0 \u00a0 <span style=\"color: #003366; font-weight: bold;\">p\u00fablico<\/span> cadena Id <span style=\"color: #009900;\">{<\/span> consiga<span style=\"color: #339933;\">;<\/span> configure<span style=\"color: #339933;\">;<\/span> <span style=\"color: #009900;\">}<\/span><br \/>\u00a0 \u00a0 <br \/>\u00a0 \u00a0 <span style=\"color: #009900;\">[<\/span>JsonProperty<span style=\"color: #009900;\">(<\/span><span style=\"color: #3366CC;\">\"nombre de usuario\"<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #009900;\">]<\/span><br \/>\u00a0 \u00a0 <span style=\"color: #003366; font-weight: bold;\">p\u00fablico<\/span> cadena Nombre de usuario <span style=\"color: #009900;\">{<\/span> consiga<span style=\"color: #339933;\">;<\/span> configure<span style=\"color: #339933;\">;<\/span> <span style=\"color: #009900;\">}<\/span><br \/>\u00a0 \u00a0 <br \/>\u00a0 \u00a0 <span style=\"color: #009900;\">[<\/span>JsonProperty<span style=\"color: #009900;\">(<\/span><span style=\"color: #3366CC;\">\"contrase\u00f1a\"<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #009900;\">]<\/span><br \/>\u00a0 \u00a0 <span style=\"color: #003366; font-weight: bold;\">p\u00fablico<\/span> cadena Contrase\u00f1a <span style=\"color: #009900;\">{<\/span> consiga<span style=\"color: #339933;\">;<\/span> configure<span style=\"color: #339933;\">;<\/span> <span style=\"color: #009900;\">}<\/span><br \/>\u00a0 \u00a0 <br \/>\u00a0 \u00a0 <span style=\"color: #009900;\">[<\/span>JsonProperty<span style=\"color: #009900;\">(<\/span><span style=\"color: #3366CC;\">\"tipo\"<\/span><span style=\"color: #009900;\">)<\/span><span style=\"color: #009900;\">]<\/span><br \/>\u00a0 \u00a0 <span style=\"color: #003366; font-weight: bold;\">p\u00fablico<\/span> cadena Tipo <span style=\"color: #009900;\">{<\/span> consiga <span style=\"color: #009900;\">{<\/span> <span style=\"color: #000066; font-weight: bold;\">devolver<\/span> <span style=\"color: #3366CC;\">\"usuario\"<\/span><span style=\"color: #339933;\">;<\/span> <span style=\"color: #009900;\">}<\/span> <span style=\"color: #009900;\">}<\/span><br \/><span style=\"color: #009900;\">}<\/span><\/p>\n<p><span style=\"color: #006600; font-style: italic;\">\/\/almacenado como { \"username\" : \"hmoody\", \"password\" : \"b3cca\" }<\/span><\/div>\n<\/div>\n<p>Aunque este enfoque es habitual en aplicaciones en las que los documentos se leen y se escriben a partir de objetos de dominio bien definidos, hay casos en los que la estructura de los documentos est\u00e1 intencionadamente menos definida.  En tales casos, podr\u00eda no ser factible tener un objeto de dominio por tipo de documento.\u00a0<\/p>\n<p>Mientras que en lenguajes como Python o Ruby, puede ser com\u00fan utilizar un enfoque menos orientado a objetos (por ejemplo, diccionarios o hashes), en lenguajes fuertemente tipados como C# o Java, es mucho m\u00e1s com\u00fan representar los datos de la aplicaci\u00f3n utilizando objetos de datos fuertemente tipados, a menudo llamados objetos simples (Java|C#).  Sin embargo, es ciertamente posible utilizar enfoques de lenguajes din\u00e1micos con estos lenguajes.\u00a0<\/p>\n<p>Cuando un usuario pregunt\u00f3 recientemente <a href=\"https:\/\/stackoverflow.com\/questions\/14568254\/couchbase-deserialize-json-into-dynamic-type\">en StackOverflow<\/a> c\u00f3mo extraer documentos JSON de Couchbase y convertirlos en objetos C# de tipado flexible, propuse dos opciones.  Para el resto de este post, voy a describir algunos m\u00e9todos b\u00e1sicos de extensi\u00f3n que podr\u00edas utilizar para adoptar un enfoque similar con tus datos.<\/p>\n<p>El primer enfoque consiste en almacenar <em>Diccionario<string, object><\/em> instancias.  Los diccionarios se adaptan naturalmente a las estructuras JSON, por lo que son una opci\u00f3n natural para trabajar con documentos de forma menos estructurada.  Los diccionarios anidados tambi\u00e9n se adaptan bien a estructuras JSON complejas.\u00a0<\/p>\n<div class=\"geshifilter\">\n<div class=\"csharp geshifilter-csharp\" style=\"font-family:monospace;\">var usuario1 <span style=\"color: #008000;\">=<\/span> <a href=\"https:\/\/www.google.com\/search?q=new+msdn.microsoft.com\"><span style=\"color: #008000;\">nuevo<\/span><\/a> Diccionario<span style=\"color: #008000;\"><<\/span><span style=\"color: #6666cc; font-weight: bold;\">cadena<\/span>, <span style=\"color: #6666cc; font-weight: bold;\">objeto<\/span><span style=\"color: #008000;\">><\/span><br \/><span style=\"color: #008000;\">{<\/span><br \/>\u00a0 \u00a0 <span style=\"color: #008000;\">{<\/span> <span style=\"color: #666666;\">\"nombre de usuario\"<\/span>, <span style=\"color: #666666;\">\"jzablocki\"<\/span> <span style=\"color: #008000;\">}<\/span>,<br \/>\u00a0 \u00a0 <span style=\"color: #008000;\">{<\/span> <span style=\"color: #666666;\">\"preferencias\"<\/span>, <a href=\"https:\/\/www.google.com\/search?q=new+msdn.microsoft.com\"><span style=\"color: #008000;\">nuevo<\/span><\/a> Diccionario<span style=\"color: #008000;\"><<\/span><span style=\"color: #6666cc; font-weight: bold;\">cadena<\/span>, <span style=\"color: #6666cc; font-weight: bold;\">objeto<\/span><span style=\"color: #008000;\">><\/span><br \/>\u00a0 \u00a0 \u00a0 \u00a0 <span style=\"color: #008000;\">{<\/span><br \/>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span style=\"color: #008000;\">{<\/span> <span style=\"color: #666666;\">\"tema\"<\/span>, \u00a0<span style=\"color: #666666;\">\"verde\"<\/span><span style=\"color: #008000;\">}<\/span>,<br \/>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span style=\"color: #008000;\">{<\/span> <span style=\"color: #666666;\">\"zona horaria\"<\/span>, \u00a0<span style=\"color: #666666;\">\"EST\"<\/span> <span style=\"color: #008000;\">}<\/span><br \/>\u00a0 \u00a0 \u00a0 \u00a0 <span style=\"color: #008000;\">}<\/span><br \/>\u00a0 \u00a0 <span style=\"color: #008000;\">}<\/span><br \/><span style=\"color: #008000;\">}<\/span><span style=\"color: #008000;\">;<\/span><\/div>\n<\/div>\n<p>Para guardar y leer este documento, a\u00f1adiremos m\u00e9todos de extensi\u00f3n para guardar y recuperar diccionarios.  Estos m\u00e9todos vivir\u00e1n dentro de una nueva clase est\u00e1tica llamada <em>CouchbaseDynamicExtensions<\/em>.<\/p>\n<div class=\"geshifilter\">\n<div class=\"csharp geshifilter-csharp\" style=\"font-family:monospace;\"><span style=\"color: #0600FF; font-weight: bold;\">p\u00fablico<\/span> <span style=\"color: #0600FF; font-weight: bold;\">est\u00e1tico<\/span> <span style=\"color: #6666cc; font-weight: bold;\">clase<\/span> CouchbaseDynamicExtensions <span style=\"color: #008000;\">{<\/span> <span style=\"color: #008000;\">&#8230;<\/span> <span style=\"color: #008000;\">}<\/span><\/div>\n<\/div>\n<p>El primer m\u00e9todo simplemente envolver\u00e1 el <em>EjecutarTienda<\/em> pero encapsular\u00e1 algunas cosas.  Primero, se encargar\u00e1 de serializar el Diccionario a JSON usando la librer\u00eda Newtonsoft.JSON.  Puede modificar la configuraci\u00f3n del serializador para soportar camel casing u otras opciones de formato JSON.  He dejado los valores por defecto en su lugar.  Segundo, he encapsulado el <em>IStoreOperationResponse <\/em>en una devoluci\u00f3n de tupla m\u00e1s sencilla.  Dado que las tuplas son com\u00fanmente devueltas en lenguajes din\u00e1micos, y estoy tratando de ser m\u00e1s din\u00e1mico, esto parec\u00eda un enfoque apropiado.<\/p>\n<div class=\"geshifilter\">\n<div class=\"csharp geshifilter-csharp\" style=\"font-family:monospace;\"><span style=\"color: #0600FF; font-weight: bold;\">p\u00fablico<\/span> <span style=\"color: #0600FF; font-weight: bold;\">est\u00e1tico<\/span> Tupla<span style=\"color: #008000;\"><<\/span><span style=\"color: #6666cc; font-weight: bold;\">bool<\/span>, <span style=\"color: #6666cc; font-weight: bold;\">int<\/span>, <span style=\"color: #6666cc; font-weight: bold;\">cadena<\/span><span style=\"color: #008000;\">><\/span> AlmacenarDiccionario<span style=\"color: #008000;\">(<\/span><span style=\"color: #0600FF; font-weight: bold;\">este<\/span> ICouchbaseClient cliente, StoreMode storeMode,<br \/>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span style=\"color: #6666cc; font-weight: bold;\">cadena<\/span> clave, Diccionario<span style=\"color: #008000;\"><<\/span><span style=\"color: #6666cc; font-weight: bold;\">cadena<\/span>, <span style=\"color: #6666cc; font-weight: bold;\">objeto<\/span><span style=\"color: #008000;\">><\/span> diccionario<span style=\"color: #008000;\">)<\/span><br \/><span style=\"color: #008000;\">{<\/span><br \/>\u00a0 \u00a0 var json <span style=\"color: #008000;\">=<\/span> JsonConvert<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">SerializarObjeto<\/span><span style=\"color: #008000;\">(<\/span>diccionario<span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>\u00a0 \u00a0 var resultado <span style=\"color: #008000;\">=<\/span> cliente<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">EjecutarTienda<\/span><span style=\"color: #008000;\">(<\/span>storeMode, clave, json<span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><\/p>\n<p>\u00a0 \u00a0 <span style=\"color: #0600FF; font-weight: bold;\">si<\/span> <span style=\"color: #008000;\">(<\/span><span style=\"color: #008000;\">!<\/span>resultado<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">\u00c9xito<\/span><span style=\"color: #008000;\">)<\/span><br \/>\u00a0 \u00a0 <span style=\"color: #008000;\">{<\/span><br \/>\u00a0 \u00a0 \u00a0 \u00a0 <span style=\"color: #0600FF; font-weight: bold;\">si<\/span> <span style=\"color: #008000;\">(<\/span>resultado<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Excepci\u00f3n<\/span> <span style=\"color: #008000;\">!=<\/span> <span style=\"color: #0600FF; font-weight: bold;\">null<\/span><span style=\"color: #008000;\">)<\/span> <span style=\"color: #0600FF; font-weight: bold;\">tirar<\/span> resultado<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Excepci\u00f3n<\/span><span style=\"color: #008000;\">;<\/span><\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 <span style=\"color: #0600FF; font-weight: bold;\">devolver<\/span> Tupla<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Cree<\/span><span style=\"color: #008000;\">(<\/span><span style=\"color: #0600FF; font-weight: bold;\">falso<\/span>Resultado<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">C\u00f3digoEstado<\/span><span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">HasValue<\/span> <span style=\"color: #008000;\">?<\/span> resultado<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">C\u00f3digoEstado<\/span><span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Valor<\/span> <span style=\"color: #008000;\">:<\/span> <span style=\"color: #008000;\">&#8211;<\/span><span style=\"color: #FF0000;\">1<\/span>Resultado<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Mensaje<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>\u00a0 \u00a0 <span style=\"color: #008000;\">}<\/span><\/p>\n<p>\u00a0 \u00a0 <span style=\"color: #0600FF; font-weight: bold;\">devolver<\/span> Tupla<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Cree<\/span><span style=\"color: #008000;\">(<\/span><span style=\"color: #0600FF; font-weight: bold;\">verdadero<\/span>, <span style=\"color: #FF0000;\">0<\/span>, <span style=\"color: #6666cc; font-weight: bold;\">cadena<\/span><span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Vac\u00edo<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/><span style=\"color: #008000;\">}<\/span><\/div>\n<\/div>\n<p>Recuperar el diccionario del JSON almacenado simplemente invierte el proceso.  De nuevo, estoy envolviendo el IGetOperationResult en un Tuple y encarg\u00e1ndome de deserializar el JSON almacenado en un archivo <em>Diccionario<string, object><\/em> instancia.<\/p>\n<div class=\"geshifilter\">\n<div class=\"csharp geshifilter-csharp\" style=\"font-family:monospace;\"><span style=\"color: #0600FF; font-weight: bold;\">p\u00fablico<\/span> <span style=\"color: #0600FF; font-weight: bold;\">est\u00e1tico<\/span> Tupla<span style=\"color: #008000;\"><<\/span><span style=\"color: #6666cc; font-weight: bold;\">bool<\/span>, <span style=\"color: #6666cc; font-weight: bold;\">int<\/span>, <span style=\"color: #6666cc; font-weight: bold;\">cadena<\/span>Diccionario<span style=\"color: #008000;\"><<\/span><span style=\"color: #6666cc; font-weight: bold;\">cadena<\/span>, <span style=\"color: #6666cc; font-weight: bold;\">objeto<\/span><span style=\"color: #008000;\">>><\/span> GetDictionary<span style=\"color: #008000;\">(<\/span><span style=\"color: #0600FF; font-weight: bold;\">este<\/span> ICouchbaseClient cliente, <span style=\"color: #6666cc; font-weight: bold;\">cadena<\/span> clave<span style=\"color: #008000;\">)<\/span><br \/><span style=\"color: #008000;\">{<\/span><br \/>\u00a0 \u00a0 var resultado <span style=\"color: #008000;\">=<\/span> cliente<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">EjecuteGet<\/span><span style=\"color: #008000;\"><<\/span><span style=\"color: #6666cc; font-weight: bold;\">cadena<\/span><span style=\"color: #008000;\">><\/span><span style=\"color: #008000;\">(<\/span>clave<span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><\/p>\n<p>\u00a0 \u00a0 <span style=\"color: #0600FF; font-weight: bold;\">si<\/span> <span style=\"color: #008000;\">(<\/span><span style=\"color: #008000;\">!<\/span>resultado<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">\u00c9xito<\/span><span style=\"color: #008000;\">)<\/span><br \/>\u00a0 \u00a0 <span style=\"color: #008000;\">{<\/span><br \/>\u00a0 \u00a0 \u00a0 \u00a0 <span style=\"color: #0600FF; font-weight: bold;\">si<\/span> <span style=\"color: #008000;\">(<\/span>resultado<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Excepci\u00f3n<\/span> <span style=\"color: #008000;\">!=<\/span> <span style=\"color: #0600FF; font-weight: bold;\">null<\/span><span style=\"color: #008000;\">)<\/span> <span style=\"color: #0600FF; font-weight: bold;\">tirar<\/span> resultado<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Excepci\u00f3n<\/span><span style=\"color: #008000;\">;<\/span><\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 <span style=\"color: #0600FF; font-weight: bold;\">devolver<\/span> Tupla<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Cree<\/span><span style=\"color: #008000;\"><<\/span><span style=\"color: #6666cc; font-weight: bold;\">bool<\/span>, <span style=\"color: #6666cc; font-weight: bold;\">int<\/span>, <span style=\"color: #6666cc; font-weight: bold;\">cadena<\/span>Diccionario<span style=\"color: #008000;\"><<\/span><span style=\"color: #6666cc; font-weight: bold;\">cadena<\/span>, <span style=\"color: #6666cc; font-weight: bold;\">objeto<\/span><span style=\"color: #008000;\">>><\/span><br \/>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span style=\"color: #008000;\">(<\/span><span style=\"color: #0600FF; font-weight: bold;\">falso<\/span>Resultado<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">C\u00f3digoEstado<\/span><span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">HasValue<\/span> <span style=\"color: #008000;\">?<\/span> resultado<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">C\u00f3digoEstado<\/span><span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Valor<\/span> <span style=\"color: #008000;\">:<\/span> <span style=\"color: #008000;\">&#8211;<\/span><span style=\"color: #FF0000;\">1<\/span>Resultado<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Mensaje<\/span>, <span style=\"color: #0600FF; font-weight: bold;\">null<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>\u00a0 \u00a0 <span style=\"color: #008000;\">}<\/span><\/p>\n<p>\u00a0 \u00a0 var dict <span style=\"color: #008000;\">=<\/span> JsonConvert<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">DeserializarObjeto<\/span><span style=\"color: #008000;\"><<\/span>Diccionario<span style=\"color: #008000;\"><<\/span><span style=\"color: #6666cc; font-weight: bold;\">cadena<\/span>, <span style=\"color: #6666cc; font-weight: bold;\">objeto<\/span><span style=\"color: #008000;\">>><\/span><span style=\"color: #008000;\">(<\/span>resultado<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Valor<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>\u00a0 \u00a0 <span style=\"color: #0600FF; font-weight: bold;\">devolver<\/span> Tupla<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Cree<\/span><span style=\"color: #008000;\">(<\/span><span style=\"color: #0600FF; font-weight: bold;\">verdadero<\/span>, <span style=\"color: #FF0000;\">0<\/span>, <span style=\"color: #6666cc; font-weight: bold;\">cadena<\/span><span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Vac\u00edo<\/span>, dict<span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/><span style=\"color: #008000;\">}<\/span><\/div>\n<\/div>\n<p>Guardar y recuperar es sencillo (aseg\u00farese de a\u00f1adir un using al espacio de nombres de su clase de extensi\u00f3n).<\/p>\n<div class=\"geshifilter\">\n<div class=\"csharp geshifilter-csharp\" style=\"font-family:monospace;\">var resultado <span style=\"color: #008000;\">=<\/span> cliente<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">AlmacenarDiccionario<\/span><span style=\"color: #008000;\">(<\/span>StoreMode<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Establecer<\/span>, <span style=\"color: #666666;\">\"usuario_1\"<\/span>usuario1<span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/><span style=\"color: #0600FF; font-weight: bold;\">si<\/span> <span style=\"color: #008000;\">(<\/span>resultado<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Art\u00edculo1<\/span><span style=\"color: #008000;\">)<\/span> <br \/><span style=\"color: #008000;\">{<\/span><br \/>\u00a0 \u00a0var dict <span style=\"color: #008000;\">=<\/span> cliente<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">GetDictionary<\/span><span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">\"usuario_1\"<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Art\u00edculo4<\/span><span style=\"color: #008000;\">;<\/span><br \/>\u00a0 \u00a0Consola<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">WriteLine<\/span><span style=\"color: #008000;\">(<\/span>dic<span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span> <span style=\"color: #008080; font-style: italic;\">\/\/deber\u00eda ser la salida de Dictionary.ToString()<\/span><br \/><span style=\"color: #008000;\">}<\/span><\/div>\n<\/div>\n<p>Un enfoque m\u00e1s interesante ser\u00eda aprovechar la nueva funci\u00f3n de C# <em>din\u00e1mico<\/em> mecanograf\u00eda y la <em>ExpandoObject<\/em> clase.  Estas caracter\u00edsticas permiten a los desarrolladores indicar al compilador que realice la comprobaci\u00f3n de tipos en tiempo de ejecuci\u00f3n, no en tiempo de compilaci\u00f3n.  Trabajar con documentos JSON es un gran caso de uso para la din\u00e1mica.<\/p>\n<p>Los m\u00e9todos de extensi\u00f3n din\u00e1mica son casi id\u00e9nticos, salvo que donde antes hab\u00eda diccionarios, ahora hay tipos din\u00e1micos.\u00a0<\/p>\n<div class=\"geshifilter\">\n<div class=\"csharp geshifilter-csharp\" style=\"font-family:monospace;\"><span style=\"color: #0600FF; font-weight: bold;\">p\u00fablico<\/span> <span style=\"color: #0600FF; font-weight: bold;\">est\u00e1tico<\/span> Tupla<span style=\"color: #008000;\"><<\/span><span style=\"color: #6666cc; font-weight: bold;\">bool<\/span>, <span style=\"color: #6666cc; font-weight: bold;\">int<\/span>, <span style=\"color: #6666cc; font-weight: bold;\">cadena<\/span><span style=\"color: #008000;\">><\/span> TiendaDin\u00e1mica<span style=\"color: #008000;\">(<\/span><span style=\"color: #0600FF; font-weight: bold;\">este<\/span> ICouchbaseClient cliente, StoreMode storeMode,<br \/>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span style=\"color: #6666cc; font-weight: bold;\">cadena<\/span> key, ExpandoObject obj<span style=\"color: #008000;\">)<\/span><br \/><span style=\"color: #008000;\">{<\/span><br \/>\u00a0 \u00a0 var json <span style=\"color: #008000;\">=<\/span> JsonConvert<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">SerializarObjeto<\/span><span style=\"color: #008000;\">(<\/span>obj<span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>\u00a0 \u00a0 var resultado <span style=\"color: #008000;\">=<\/span> cliente<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">EjecutarTienda<\/span><span style=\"color: #008000;\">(<\/span>storeMode, clave, json<span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><\/p>\n<p>\u00a0 \u00a0 <span style=\"color: #0600FF; font-weight: bold;\">si<\/span> <span style=\"color: #008000;\">(<\/span><span style=\"color: #008000;\">!<\/span>resultado<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">\u00c9xito<\/span><span style=\"color: #008000;\">)<\/span><br \/>\u00a0 \u00a0 <span style=\"color: #008000;\">{<\/span><br \/>\u00a0 \u00a0 \u00a0 \u00a0 <span style=\"color: #0600FF; font-weight: bold;\">si<\/span> <span style=\"color: #008000;\">(<\/span>resultado<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Excepci\u00f3n<\/span> <span style=\"color: #008000;\">!=<\/span> <span style=\"color: #0600FF; font-weight: bold;\">null<\/span><span style=\"color: #008000;\">)<\/span> <span style=\"color: #0600FF; font-weight: bold;\">tirar<\/span> resultado<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Excepci\u00f3n<\/span> <span style=\"color: #0600FF; font-weight: bold;\">como<\/span> Excepci\u00f3n<span style=\"color: #008000;\">;<\/span><\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 <span style=\"color: #0600FF; font-weight: bold;\">devolver<\/span> Tupla<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Cree<\/span><span style=\"color: #008000;\">(<\/span><span style=\"color: #0600FF; font-weight: bold;\">falso<\/span>Resultado<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">C\u00f3digoEstado<\/span><span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">HasValue<\/span> <span style=\"color: #008000;\">?<\/span> resultado<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">C\u00f3digoEstado<\/span><span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Valor<\/span> <span style=\"color: #008000;\">:<\/span> <span style=\"color: #008000;\">&#8211;<\/span><span style=\"color: #FF0000;\">1<\/span>Resultado<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Mensaje<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>\u00a0 \u00a0 <span style=\"color: #008000;\">}<\/span><\/p>\n<p>\u00a0 \u00a0 <span style=\"color: #0600FF; font-weight: bold;\">devolver<\/span> Tupla<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Cree<\/span><span style=\"color: #008000;\">(<\/span><span style=\"color: #0600FF; font-weight: bold;\">verdadero<\/span>, <span style=\"color: #FF0000;\">0<\/span>, <span style=\"color: #6666cc; font-weight: bold;\">cadena<\/span><span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Vac\u00edo<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/><span style=\"color: #008000;\">}<\/span><\/p>\n<p><span style=\"color: #0600FF; font-weight: bold;\">p\u00fablico<\/span> <span style=\"color: #0600FF; font-weight: bold;\">est\u00e1tico<\/span> Tupla<span style=\"color: #008000;\"><<\/span><span style=\"color: #6666cc; font-weight: bold;\">bool<\/span>, <span style=\"color: #6666cc; font-weight: bold;\">int<\/span>, <span style=\"color: #6666cc; font-weight: bold;\">cadena<\/span>ExpandoObjeto<span style=\"color: #008000;\">><\/span> GetDynamic<span style=\"color: #008000;\">(<\/span><span style=\"color: #0600FF; font-weight: bold;\">este<\/span> ICouchbaseClient cliente, <span style=\"color: #6666cc; font-weight: bold;\">cadena<\/span> clave<span style=\"color: #008000;\">)<\/span><br \/><span style=\"color: #008000;\">{<\/span><br \/>\u00a0 \u00a0 var resultado <span style=\"color: #008000;\">=<\/span> cliente<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">EjecuteGet<\/span><span style=\"color: #008000;\"><<\/span><span style=\"color: #6666cc; font-weight: bold;\">cadena<\/span><span style=\"color: #008000;\">><\/span><span style=\"color: #008000;\">(<\/span>clave<span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><\/p>\n<p>\u00a0 \u00a0 <span style=\"color: #0600FF; font-weight: bold;\">si<\/span> <span style=\"color: #008000;\">(<\/span><span style=\"color: #008000;\">!<\/span>resultado<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">\u00c9xito<\/span><span style=\"color: #008000;\">)<\/span><br \/>\u00a0 \u00a0 <span style=\"color: #008000;\">{<\/span><br \/>\u00a0 \u00a0 \u00a0 \u00a0 <span style=\"color: #0600FF; font-weight: bold;\">si<\/span> <span style=\"color: #008000;\">(<\/span>resultado<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Excepci\u00f3n<\/span> <span style=\"color: #008000;\">!=<\/span> <span style=\"color: #0600FF; font-weight: bold;\">null<\/span><span style=\"color: #008000;\">)<\/span> <span style=\"color: #0600FF; font-weight: bold;\">tirar<\/span> resultado<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Excepci\u00f3n<\/span><span style=\"color: #008000;\">;<\/span><\/p>\n<p>\u00a0 \u00a0 \u00a0 \u00a0 <span style=\"color: #0600FF; font-weight: bold;\">devolver<\/span> Tupla<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Cree<\/span><span style=\"color: #008000;\"><<\/span><span style=\"color: #6666cc; font-weight: bold;\">bool<\/span>, <span style=\"color: #6666cc; font-weight: bold;\">int<\/span>, <span style=\"color: #6666cc; font-weight: bold;\">cadena<\/span>ExpandoObjeto<span style=\"color: #008000;\">><\/span><br \/>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <span style=\"color: #008000;\">(<\/span><span style=\"color: #0600FF; font-weight: bold;\">falso<\/span>Resultado<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">C\u00f3digoEstado<\/span><span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">HasValue<\/span> <span style=\"color: #008000;\">?<\/span> resultado<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">C\u00f3digoEstado<\/span><span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Valor<\/span> <span style=\"color: #008000;\">:<\/span> <span style=\"color: #008000;\">&#8211;<\/span><span style=\"color: #FF0000;\">1<\/span>Resultado<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Mensaje<\/span>, <span style=\"color: #0600FF; font-weight: bold;\">null<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>\u00a0 \u00a0 <span style=\"color: #008000;\">}<\/span><\/p>\n<p>\u00a0 \u00a0 var obj <span style=\"color: #008000;\">=<\/span> JsonConvert<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">DeserializarObjeto<\/span><span style=\"color: #008000;\"><<\/span>ExpandoObject<span style=\"color: #008000;\">><\/span><span style=\"color: #008000;\">(<\/span>resultado<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Valor<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>\u00a0 \u00a0 <span style=\"color: #0600FF; font-weight: bold;\">devolver<\/span> Tupla<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Cree<\/span><span style=\"color: #008000;\">(<\/span><span style=\"color: #0600FF; font-weight: bold;\">verdadero<\/span>, <span style=\"color: #FF0000;\">0<\/span>, <span style=\"color: #6666cc; font-weight: bold;\">cadena<\/span><span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Vac\u00edo<\/span>, obj<span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/><span style=\"color: #008000;\">}<\/span><\/div>\n<\/div>\n<p>Usando instancias din\u00e1micas en tu c\u00f3digo, puedes guardar y recuperar datos desde y hacia Couchbase Server.  Tenga en cuenta que tambi\u00e9n podr\u00eda leer cualquier documento JSON en un ExpandoObject utilizando el enfoque de c\u00f3digo a continuaci\u00f3n.  Para probarlo, puede llamar a <em>GetDynamic <\/em>con una clave de \"usuario_1\".<\/p>\n<div class=\"geshifilter\">\n<div class=\"csharp geshifilter-csharp\" style=\"font-family:monospace;\">usuario din\u00e1mico2 <span style=\"color: #008000;\">=<\/span> <a href=\"https:\/\/www.google.com\/search?q=new+msdn.microsoft.com\"><span style=\"color: #008000;\">nuevo<\/span><\/a> ExpandoObject<span style=\"color: #008000;\">(<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>usuario2<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Nombre de usuario<\/span> <span style=\"color: #008000;\">=<\/span> <span style=\"color: #666666;\">\"jzablocki\"<\/span><span style=\"color: #008000;\">;<\/span><br \/>usuario2<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Preferencias<\/span> <span style=\"color: #008000;\">=<\/span> <a href=\"https:\/\/www.google.com\/search?q=new+msdn.microsoft.com\"><span style=\"color: #008000;\">nuevo<\/span><\/a> ExpandoObject<span style=\"color: #008000;\">(<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>usuario2<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Preferencias<\/span><span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Tema<\/span> <span style=\"color: #008000;\">=<\/span> <span style=\"color: #666666;\">\"verde\"<\/span><span style=\"color: #008000;\">;<\/span><br \/>usuario2<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Preferencias<\/span><span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Zona horaria<\/span> <span style=\"color: #008000;\">=<\/span> <span style=\"color: #666666;\">\"EST\"<\/span><span style=\"color: #008000;\">;<\/span><\/p>\n<p>cliente<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">TiendaDin\u00e1mica<\/span><span style=\"color: #008000;\">(<\/span>StoreMode<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Establecer<\/span>, <span style=\"color: #666666;\">\"usuario_2\"<\/span>usuario2 <span style=\"color: #0600FF; font-weight: bold;\">como<\/span> ExpandoObject<span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/>var getResultado <span style=\"color: #008000;\">=<\/span> cliente<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">GetDynamic<\/span><span style=\"color: #008000;\">(<\/span><span style=\"color: #666666;\">\"usuario_2\"<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/><span style=\"color: #0600FF; font-weight: bold;\">si<\/span> <span style=\"color: #008000;\">(<\/span>obtenerResultado<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Art\u00edculo1<\/span><span style=\"color: #008000;\">)<\/span><br \/><span style=\"color: #008000;\">{<\/span><br \/>\u00a0 \u00a0 elemento din\u00e1mico <span style=\"color: #008000;\">=<\/span> obtenerResultado<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Art\u00edculo4<\/span><span style=\"color: #008000;\">;<\/span><br \/>\u00a0 \u00a0 Consola<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">WriteLine<\/span><span style=\"color: #008000;\">(<\/span>art\u00edculo<span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Preferencias<\/span><span style=\"color: #008000;\">.<\/span><span style=\"color: #0000FF;\">Tema<\/span><span style=\"color: #008000;\">)<\/span><span style=\"color: #008000;\">;<\/span><br \/><span style=\"color: #008000;\">}<\/span><\/div>\n<\/div>\n<p>Hay enfoques alternativos hacia las extensiones din\u00e1micas que requieren casting, debido a las limitaciones de llamar a un m\u00e9todo de extensi\u00f3n con argumentos din\u00e1micos.  Para simplificar las cosas, me he quedado con <em>ExpandoObject<\/em> argumentos.\u00a0<\/p>\n<div>Obviamente, C# no es un lenguaje puramente din\u00e1mico y, por tanto, algunos de los m\u00e9todos son menos concisos de lo que ser\u00edan en sus hom\u00f3logos puramente de tipado tard\u00edo.  Sin embargo, estos m\u00e9todos demuestran que no tienes que renunciar a toda la riqueza de una base de datos orientada a documentos sin esquema s\u00f3lo porque tu lenguaje sea est\u00e1ticamente tipado, siempre que ese lenguaje sea C#, por supuesto...<\/div>","protected":false},"excerpt":{"rendered":"<p>One of the significant benefits of working with Couchbase Server 2.0 is its flexible schema.\u00a0 Documents are stored as JSON, allowing for implicitly structured records that impose no order on each other.\u00a0 In the real world, that &#8220;implicit structure&#8221; comes [&hellip;]<\/p>","protected":false},"author":22,"featured_media":13873,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1],"tags":[],"ppma_author":[8980],"class_list":["post-1709","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.0 (Yoast SEO v26.0) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Moving No Schema up the Stack with C# and Dynamic Types - The Couchbase Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/blog\/es\/moving-no-schema-stack-c-and-dynamic-types\/\" \/>\n<meta property=\"og:locale\" content=\"es_MX\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Moving No Schema up the Stack with C# and Dynamic Types\" \/>\n<meta property=\"og:description\" content=\"One of the significant benefits of working with Couchbase Server 2.0 is its flexible schema.\u00a0 Documents are stored as JSON, allowing for implicitly structured records that impose no order on each other.\u00a0 In the real world, that &#8220;implicit structure&#8221; comes [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/es\/moving-no-schema-stack-c-and-dynamic-types\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2014-12-16T19:05:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/11\/couchbase-nosql-dbaas.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1800\" \/>\n\t<meta property=\"og:image:height\" content=\"630\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"John Zablocki, NET. SDK Developer, Couchbase\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"John Zablocki, NET. SDK Developer, Couchbase\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/moving-no-schema-stack-c-and-dynamic-types\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/moving-no-schema-stack-c-and-dynamic-types\/\"},\"author\":{\"name\":\"John Zablocki, NET. SDK Developer, Couchbase\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/ee312fb775c13d20a32f1d455888a282\"},\"headline\":\"Moving No Schema up the Stack with C# and Dynamic Types\",\"datePublished\":\"2014-12-16T19:05:13+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/moving-no-schema-stack-c-and-dynamic-types\/\"},\"wordCount\":989,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/moving-no-schema-stack-c-and-dynamic-types\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"articleSection\":[\"Uncategorized\"],\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/moving-no-schema-stack-c-and-dynamic-types\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/moving-no-schema-stack-c-and-dynamic-types\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/moving-no-schema-stack-c-and-dynamic-types\/\",\"name\":\"Moving No Schema up the Stack with C# and Dynamic Types - The Couchbase Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/moving-no-schema-stack-c-and-dynamic-types\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/moving-no-schema-stack-c-and-dynamic-types\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"datePublished\":\"2014-12-16T19:05:13+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/moving-no-schema-stack-c-and-dynamic-types\/#breadcrumb\"},\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/moving-no-schema-stack-c-and-dynamic-types\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/moving-no-schema-stack-c-and-dynamic-types\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"width\":1800,\"height\":630},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/moving-no-schema-stack-c-and-dynamic-types\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Moving No Schema up the Stack with C# and Dynamic Types\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"es\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/ee312fb775c13d20a32f1d455888a282\",\"name\":\"John Zablocki, NET. SDK Developer, Couchbase\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/201925d9efc4992ce80385b76fdea34b\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/8c5a77152c796c424a3f7f6d9fa31a999a7fe115d64c2acc93c4c0c014e6512a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/8c5a77152c796c424a3f7f6d9fa31a999a7fe115d64c2acc93c4c0c014e6512a?s=96&d=mm&r=g\",\"caption\":\"John Zablocki, NET. SDK Developer, Couchbase\"},\"description\":\"John Zablocki is a NET. SDK Developer at Couchbase. John is also the organizer of Beantown ALT.NET and a former adjunct at Fairfield University. You can also check out the book on Amazon named \\\"Couchbase Essentials\\\" which explains how to install and configure Couchbase Server.\",\"url\":\"https:\/\/www.couchbase.com\/blog\/es\/author\/john-zablocki\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Moving No Schema up the Stack with C# and Dynamic Types - The Couchbase Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/blog\/es\/moving-no-schema-stack-c-and-dynamic-types\/","og_locale":"es_MX","og_type":"article","og_title":"Moving No Schema up the Stack with C# and Dynamic Types","og_description":"One of the significant benefits of working with Couchbase Server 2.0 is its flexible schema.\u00a0 Documents are stored as JSON, allowing for implicitly structured records that impose no order on each other.\u00a0 In the real world, that &#8220;implicit structure&#8221; comes [&hellip;]","og_url":"https:\/\/www.couchbase.com\/blog\/es\/moving-no-schema-stack-c-and-dynamic-types\/","og_site_name":"The Couchbase Blog","article_published_time":"2014-12-16T19:05:13+00:00","og_image":[{"width":1800,"height":630,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2022\/11\/couchbase-nosql-dbaas.png","type":"image\/png"}],"author":"John Zablocki, NET. SDK Developer, Couchbase","twitter_card":"summary_large_image","twitter_misc":{"Written by":"John Zablocki, NET. SDK Developer, Couchbase","Est. reading time":"5 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/moving-no-schema-stack-c-and-dynamic-types\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/moving-no-schema-stack-c-and-dynamic-types\/"},"author":{"name":"John Zablocki, NET. SDK Developer, Couchbase","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/ee312fb775c13d20a32f1d455888a282"},"headline":"Moving No Schema up the Stack with C# and Dynamic Types","datePublished":"2014-12-16T19:05:13+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/moving-no-schema-stack-c-and-dynamic-types\/"},"wordCount":989,"commentCount":2,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/moving-no-schema-stack-c-and-dynamic-types\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","articleSection":["Uncategorized"],"inLanguage":"es","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/moving-no-schema-stack-c-and-dynamic-types\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/moving-no-schema-stack-c-and-dynamic-types\/","url":"https:\/\/www.couchbase.com\/blog\/moving-no-schema-stack-c-and-dynamic-types\/","name":"Moving No Schema up the Stack with C# and Dynamic Types - The Couchbase Blog","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/moving-no-schema-stack-c-and-dynamic-types\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/moving-no-schema-stack-c-and-dynamic-types\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","datePublished":"2014-12-16T19:05:13+00:00","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/moving-no-schema-stack-c-and-dynamic-types\/#breadcrumb"},"inLanguage":"es","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/moving-no-schema-stack-c-and-dynamic-types\/"]}]},{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/www.couchbase.com\/blog\/moving-no-schema-stack-c-and-dynamic-types\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","width":1800,"height":630},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/moving-no-schema-stack-c-and-dynamic-types\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Moving No Schema up the Stack with C# and Dynamic Types"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"El blog de Couchbase","description":"Couchbase, la base de datos NoSQL","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"es"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"El blog de Couchbase","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/ee312fb775c13d20a32f1d455888a282","name":"John Zablocki, Desarrollador NET. Desarrollador SDK, Couchbase","image":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/201925d9efc4992ce80385b76fdea34b","url":"https:\/\/secure.gravatar.com\/avatar\/8c5a77152c796c424a3f7f6d9fa31a999a7fe115d64c2acc93c4c0c014e6512a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8c5a77152c796c424a3f7f6d9fa31a999a7fe115d64c2acc93c4c0c014e6512a?s=96&d=mm&r=g","caption":"John Zablocki, NET. SDK Developer, Couchbase"},"description":"John Zablocki is a NET. SDK Developer at Couchbase. John is also the organizer of Beantown ALT.NET and a former adjunct at Fairfield University. You can also check out the book on Amazon named \"Couchbase Essentials\" which explains how to install and configure Couchbase Server.","url":"https:\/\/www.couchbase.com\/blog\/es\/author\/john-zablocki\/"}]}},"authors":[{"term_id":8980,"user_id":22,"is_guest":0,"slug":"john-zablocki","display_name":"John Zablocki, NET. SDK Developer, Couchbase","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/8c5a77152c796c424a3f7f6d9fa31a999a7fe115d64c2acc93c4c0c014e6512a?s=96&d=mm&r=g","author_category":"","last_name":"Zablocki","first_name":"John","job_title":"","user_url":"","description":"John Zablocki es desarrollador de NET. SDK en Couchbase. John es tambi\u00e9n el organizador de Beantown ALT.NET y antiguo profesor adjunto en la Universidad de Fairfield.\r\nTambi\u00e9n puedes consultar el libro en Amazon llamado \"Couchbase Essentials\" que explica c\u00f3mo instalar y configurar Couchbase Server."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts\/1709","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/users\/22"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/comments?post=1709"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts\/1709\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/media\/13873"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/media?parent=1709"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/categories?post=1709"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/tags?post=1709"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/ppma_author?post=1709"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}