/// <summary>
 /// Deprecated Method for adding a new object to the VersionResults EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToVersionResults(VersionResult versionResult)
 {
     base.AddObject("VersionResults", versionResult);
 }
Example #2
0
    private VersionResult[] ReadChartPoints(string FileName)
    {
      Contract.Requires(!String.IsNullOrWhiteSpace(FileName));
      Contract.Ensures(Contract.Result<VersionResult[]>() != null);

      VersionResult[] res;
      var ConnectionString = "data source='" + FileName + "'";//; mode='Read Only';"; doesn't work

      // read the sql DB
      var entityConnectionString = new EntityConnectionStringBuilder
      {
        Metadata = "res://*/ClousotCacheModel.csdl|res://*/ClousotCacheModel.ssdl|res://*/ClousotCacheModel.msl",
        Provider = "System.Data.SqlServerCe.3.5",
        ProviderConnectionString = ConnectionString
      }.ToString();

      using (var connection = new EntityConnection(entityConnectionString))
      {
        connection.Open();

        using (var objectContext = new ClousotCacheEntities(connection))
        {
          objectContext.ContextOptions.LazyLoadingEnabled = true; // avoid having to manually load every method

          var resList = new List<VersionResult>();
#if false
          var versionMethods = objectContext.VersionBindings.GroupBy(b => b.Version);
          var versionResults = objectContext.VersionResults.ToDictionary(r => r.Version);

          foreach (var versionMethod in versionMethods)
          {
            VersionResult versionResult;
            // Sanity check
            if (versionResults.TryGetValue(versionMethod.Key, out versionResult) && versionResult.Methods == versionMethod.LongCount())
              versionResult.Complete(); // previously computed values can be reused
            else
            {
              if (versionResult != null) // the entry needs an update
                objectContext.DeleteObject(versionResult);
              versionResult = new VersionResult(versionMethod.Key, versionMethod.Select(b => b.Method)); // recompute
              objectContext.VersionResults.AddObject(versionResult);
            }
            resList.Add(versionResult);
          }

          objectContext.SaveChanges();

          foreach (var versionResult in resList)
            objectContext.Detach(versionResult);

#endif
          res = resList.ToArray();
#if false
          var points = objectContext.VersionBindings.Include("Method").GroupBy(b => b.Version, b => b.Method, ChartPoint.Create);
          res = points.OrderBy(m => m.Version).ToArray();
#endif
        }

        connection.Close();
      }

      return res;
    }
 /// <summary>
 /// Create a new VersionResult object.
 /// </summary>
 /// <param name="version">Initial value of the Version property.</param>
 /// <param name="methods">Initial value of the Methods property.</param>
 /// <param name="contractInstructions">Initial value of the ContractInstructions property.</param>
 /// <param name="contracts">Initial value of the Contracts property.</param>
 /// <param name="methodInstructions">Initial value of the MethodInstructions property.</param>
 /// <param name="statsBottom">Initial value of the StatsBottom property.</param>
 /// <param name="statsFalse">Initial value of the StatsFalse property.</param>
 /// <param name="statsTop">Initial value of the StatsTop property.</param>
 /// <param name="statsTrue">Initial value of the StatsTrue property.</param>
 /// <param name="suggestions">Initial value of the Suggestions property.</param>
 /// <param name="swallowedBottom">Initial value of the SwallowedBottom property.</param>
 /// <param name="swallowedFalse">Initial value of the SwallowedFalse property.</param>
 /// <param name="swallowedTop">Initial value of the SwallowedTop property.</param>
 /// <param name="swallowedTrue">Initial value of the SwallowedTrue property.</param>
 /// <param name="timeout">Initial value of the Timeout property.</param>
 /// <param name="hasWarnings">Initial value of the HasWarnings property.</param>
 /// <param name="zeroTop">Initial value of the ZeroTop property.</param>
 /// <param name="outcomes">Initial value of the Outcomes property.</param>
 public static VersionResult CreateVersionResult(global::System.Int64 version, global::System.Int64 methods, global::System.Int64 contractInstructions, global::System.Int64 contracts, global::System.Int64 methodInstructions, global::System.Int64 statsBottom, global::System.Int64 statsFalse, global::System.Int64 statsTop, global::System.Int64 statsTrue, global::System.Int64 suggestions, global::System.Int64 swallowedBottom, global::System.Int64 swallowedFalse, global::System.Int64 swallowedTop, global::System.Int64 swallowedTrue, global::System.Int64 timeout, global::System.Int64 hasWarnings, global::System.Int64 zeroTop, global::System.Int64 outcomes)
 {
     VersionResult versionResult = new VersionResult();
     versionResult.Version = version;
     versionResult.Methods = methods;
     versionResult.ContractInstructions = contractInstructions;
     versionResult.Contracts = contracts;
     versionResult.MethodInstructions = methodInstructions;
     versionResult.StatsBottom = statsBottom;
     versionResult.StatsFalse = statsFalse;
     versionResult.StatsTop = statsTop;
     versionResult.StatsTrue = statsTrue;
     versionResult.Suggestions = suggestions;
     versionResult.SwallowedBottom = swallowedBottom;
     versionResult.SwallowedFalse = swallowedFalse;
     versionResult.SwallowedTop = swallowedTop;
     versionResult.SwallowedTrue = swallowedTrue;
     versionResult.Timeout = timeout;
     versionResult.HasWarnings = hasWarnings;
     versionResult.ZeroTop = zeroTop;
     versionResult.Outcomes = outcomes;
     return versionResult;
 }