Пример #1
0
        // GET api/people/545a4r4555dfasd
        public string Get(string _id)
        {
            var connection = WebConfigurationManager.ConnectionStrings["MongoDB"].ToString();
            MongoDataService dataService = new MongoDataService(connection);

            return dataService.findOne("test", "people",String.Format("{{_id: ObjectId(\"{0}\") }}", _id));
        }
Пример #2
0
        //  Error	1	Error 5: The 'Name' attribute is invalid - The value 'Asistencias_Cammesa.edmxContainer' is invalid according to its datatype 'http://schemas.microsoft.com/ado/2009/11/edm:TSimpleIdentifier' - The Pattern constraint failed.	C:\Users\jcorrales\Documents\Visual Studio 2013\Projects\MongoREST\MongoDBAPI\Models\Asistencias_Cammesa.edmx	14	17	MongoDBAPI
        /*private static MongoDataService ConnectToODBC()
        {
            try
            {
                //var connection = WebConfigurationManager.ConnectionStrings["ASISTENCIAS_CAMMESA_ENTITIES"].ToString();
               //return dataService;
            }
            catch (Exception ex)
            {

                throw ex;
            }

        }*/

        private static MongoDataService CallDataService()
        {
            try
            {
                var connection = WebConfigurationManager.ConnectionStrings["MongoDB"].ToString();
                MongoDataService dataService = new MongoDataService(connection);
                return dataService;
            }
            catch (Exception ex)
            {

                throw ex;
            }
        }