Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
825
FlatDataSource problem
posted

When I run:

                FlatDataSource flatDataSource = new FlatDataSource();
                flatDataSource.Cube = FlatDataSource.GenerateInitialCube(list.AsQueryable().ElementType.Name);

                CubeMetadata cubeMetadata = new CubeMetadata();
                cubeMetadata.DisplayName = "Sales Data";
                cubeMetadata.DataTypeFullName = list.AsQueryable().ElementType.FullName;
                cubeMetadata.DimensionSettings.Add(new DimensionMetadata()
                {
                    SourcePropertyName = "Total_Per_Student_Amount",
                    DisplayName = "Total Amount Per Student",
                    DisplayFormat = "{0:C2}"
                });
                cubeMetadata.DimensionSettings.Add(new DimensionMetadata()
                {
                    SourcePropertyName = "Total_Expense_Amount",
                    DisplayName = "Total Expense Amount",
                    DisplayFormat = "{0:C2}"
                });
                flatDataSource.CubesSettings.Add(cubeMetadata);
I keep getting "Object reference not set to an instance of an object. It says that I need to use the "new" keyword. However, I have assigned new to both the flatDataSource object and the cubeMetadata object.

What am I doing wrong?