zarzou
zarzou

Reputation: 133

Migrate from Code Fluent to Entity Framework

I want to migrate my project from Code Fluent to entity Framework. and i have a problem with some functions in the login controller

 public static System.Data.DataSet GetSpaces(System.Guid userId)
    {
        if ((userId.Equals(CodeFluentPersistence.DefaultGuidValue) == true))
        {
            throw new System.ArgumentNullException("userId");
        }
        System.Data.DataSet ret = default(System.Data.DataSet);
        CodeFluent.Runtime.CodeFluentPersistence persistence = CodeFluentContext.Get(Erpeo.Store.Model.Constants.Erpeo_Store_ModelStoreName).Persistence;
        persistence.CreateStoredProcedureCommand(null, "User", "GetSpaces");
        persistence.AddParameter("@userId", userId);
        System.Data.IDataReader reader = null;
        try
        {
            reader = persistence.ExecuteReader();
            if ((reader.Read() == true))
            {
                ret = CodeFluent.Runtime.CodeFluentPersistence.LoadDataSet(reader);
            }
        }
        finally
        {
            if ((reader != null))
            {
                reader.Dispose();
            }
            persistence.CompleteCommand();
        }
        return ret;
    }

and then they used thet getspace function like that

var user = Entities.User.LoadById(userId);
        var dataset = Entities.User.GetSpaces(userId);

        if (dataset.Tables[0] != null)
        {
            var groupBySubscriber = dataset.Tables[0].IEnumerable().GroupBy(r => r["Subscriber_Id"]);

Any advice from one who encountered this problem?

Upvotes: 1

Views: 45

Answers (0)

Related Questions