GithubHelp home page GithubHelp logo

azure.cosmos.table's Introduction

DTableEntity

Dependency :

Microsoft.Azure.Cosmos.Table

Newtonsoft.Json


  1. decimal 型別的處理,自動變成 string 儲存,還原後變回 decimal 型別

  2. 將 DateTime 型別取回後轉成 local datetime

  3. 複雜類別序列化後存入 Azure Table Storage,讀取回來後自動還原

Example :

    public class Foo : DTableEntity
    {

        public string Name { get; set; }
        public DateTime Birth { get; set; }
        public decimal Salary { get; set; }
        public List<Foo> Friend { get; set; }
        
    }
    

Insert Data Sample:

            var obj = new Foo();

            obj.PartitionKey = "PK1";
            obj.RowKey = "RK1";
            obj.Name = "許當麻";
            obj.Salary = 123456789.987654321m;
            obj.Birth = new DateTime(1983, 05, 11);

            var friend = new Foo();
            friend.Name = "許當麻的朋友1";
            friend.Salary = 123456789.987654321m;
            friend.Birth = new DateTime(1983, 05, 11);

            obj.Friend = new System.Collections.Generic.List<Foo>();
            obj.Friend.Add(friend);

            var operation = Microsoft.WindowsAzure.Storage.Table.TableOperation.InsertOrReplace(obj);
            var res = CTable.ExecuteAsync(operation).Result;
    

Result :

alt 預覽

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.