Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...Getting StartedGetting StartedCBO.FillCollection is returning empty (default value) itemsCBO.FillCollection is returning empty (default value) items
Previous
 
Next
New Post
7/3/2014 7:53 AM
 
Hello

I'm trying to create a module with Cristoc's module base and I'm hitting an error where the function CBO.FillColllection is returning an empty object.

I'm using
a Info class
a procedure on the database (returning results)
a DataProvider class (returning results) (as IDataReader)
a Controller class (empty result) (returning Info class)
a onload function calling the controlle

So, my Info class looks like:

using System;
using DotNetNuke.Entities;

namespace Christoc.Modules.NLVerwaltung
{
    public class NiederlassungenInfo : BaseEntityInfo
    {
        public int ID { get; set; }
        public string Name { get; set; }
        public string Ort { get; set; }
        public string Adresse { get; set; }
        public float Latitude { get; set; }
        public float Longitude { get; set; }
    }
}

My DataProvider class:


using System;

using System.Data;

namespace Christoc.Modules.NLVerwaltung.Components
{
    public class DataProvider
    {
        #region Shared/Static Methods
        private static readonly DataProvider provider;
        static DataProvider()
        {
            provider = new DataProvider();
        }

        public static DataProvider Instance()
        {
            return provider;
        }
        #endregion

        #region Virtual Methods
        public virtual IDataReader GetNiederlassungen()
        {
            return (DotNetNuke.Data.DataProvider.Instance().ExecuteReader("DUV_GetNiederlassungen"));
        }
        #endregion
    }
}

Controller class:
using System.Collections;
using System.Collections.Generic;
using DotNetNuke.Common.Utilities;
using Christoc.Modules.NLVerwaltung.Components;
using System.Data;

namespace Christoc.Modules.NLVerwaltung
{
    public class NiederlassungenController
    {
        public List<NiederlassungenInfo> GetNiederlassungen()
        {
            return CBO.FillCollection<NiederlassungenInfo>(DataProvider.Instance().GetNiederlassungen());
        }
    }
}


Call onload:
private readonly NiederlassungenController _NiederlassungenController = new NiederlassungenController();

private void LoadList(Repeater Repeater)
{
    List<NiederlassungenInfo> NLs = _NiederlassungenController.GetNiederlassungen();
}

So, now I'm calling _NiederlassungenController.GetNiederlassungen(),
which is calling CBO.FillCollection<NiederlassungenInfo>(DataProvider.Instance().GetNiederlassungen()),
calling DotNetNuke.Data.DataProvider.Instance().ExecuteReader("DUV_GetNiederlassungen").

The last line calls the DB procedure which has a result, so my DataReader is returning a result. (IdataReader)
Next my Controller tries to convert my IDataReader to List<NiederlassungenInfo>.

This one is failing.
The result will be a list with correct resultsize, but every list item will has the default value on all properties, so the result is empty.

The call CBO.FillCollection is comming out of the DotNetNuke.dll, namespace DotNetNuke.Common.Utilities.
If I now create a namespace i.e. DotNetNuke.Common.Utilities2 and copy the whole namespace out of the dll and use the code in my own namespace, now everything is working like expected.


Anyone knows this problem or can help with it?



Greets
Robin
 
New Post
7/8/2014 6:52 AM
 

Hi,

It sound a littlebit like security issue.

And FillCollection use reflection which can't be used in not full trust envirenments.

Maybe check your IIS pool setting to be sure working in full trust.

But i not sure what really your issue.

 
Previous
 
Next
HomeHomeDevelopment and...Development and...Getting StartedGetting StartedCBO.FillCollection is returning empty (default value) itemsCBO.FillCollection is returning empty (default value) items


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out