Elfocrash / Cosmonaut

🌐 A supercharged Azure CosmosDB .NET SDK with ORM support
https://cosmonaut.readthedocs.io
MIT License
342 stars 44 forks source link

Azure functions #9

Closed Jeremywhiteley closed 6 years ago

Jeremywhiteley commented 6 years ago

Does this work with Azure Functions?

Elfocrash commented 6 years ago

It does indeed work yes. I just tested it myself just to be 100% sure. The library is targeting .NET Standard 2.0 so there is no reason why it wouldn't.

pacohams commented 4 years ago

Hi, i try tu use normal entities to perform crud, with the example, but i dont know how to create the ServiceCollection for invoke the AddCosmosStore. i try to use the setup.cs in the project cosmonaut shared after this line builder.AddCosmosStoreBinding(); using

        var connectionPolicy = new ConnectionPolicy
        {
            ConnectionProtocol = Protocol.Tcp,
            ConnectionMode = ConnectionMode.Direct
        };

        string endPoint = System.Environment.GetEnvironmentVariable("endpoint").ToString();
        string authKey = System.Environment.GetEnvironmentVariable("authKey").ToString();
        string database = System.Environment.GetEnvironmentVariable("database").ToString();
        int defaultCollThroughput = Convert.ToInt32(System.Environment.GetEnvironmentVariable("defaultCollectionThroughput").ToString());

        var cosmosSettings = new CosmosStoreSettings(database,
            endPoint,
            authKey
            , connectionPolicy
            , defaultCollectionThroughput: defaultCollThroughput);

but when i used the function the log show error to locate the cosmosStores

Also i try to add the nuget Microsoft.Azure.Functions.Extensions for include setup.cs directly the cosmonaut.azureFunctions project, but i recieve the same error