0

I have a Converter class which I give a ID. With this ID I want to get a object as return value. But I have an Error which I don't know how to fix. The error appears at:

result = ArbeitsplatzgruppeNT.Get(arbeitsplatzgruppeId);

In my Convert Method and my ConvertBack Method is just working fine.

public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
    ArbeitsplatzgruppeNT result = null;
    Guid arbeitsplatzgruppeId = Guid.Empty;

    if (value != null && Guid.TryParse(value.ToString(), out arbeitsplatzgruppeId) && arbeitsplatzgruppeId != Guid.Empty)
    {
        try
        {
            result = ArbeitsplatzgruppeNT.Get(arbeitsplatzgruppeId); // Error 
        }

        catch (Exception)
        {
        }
    }

    return result;
}

public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
    Guid result = Guid.Empty;

    if (value != null && value is ArbeitsplatzgruppeNT)
    {
        result = (value as ArbeitsplatzgruppeNT).ID;
    }

    return result;
}

That's my GET methods in the Business-Class

public static ArbeitsplatzgruppeNT Get(Guid ID)
{
    return DataPortal.FetchChild<ArbeitsplatzgruppeNT>(ID);
}

And that's my Error:

Error 2 The type 'HGERP.Data.ArbeitsplatzGruppe' is defined in an assembly that is not referenced. You must add a reference to assembly 'HGERP.DataLayer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.

It got to do something with my business-class because I got already a version which is working. but I had to replace the ArbeitsplatzgruppeNT-class and now its not working anymore. but there isn't not a big difference between old an new ...

Anatoliy Nikolaev
  • 22,370
  • 15
  • 69
  • 68
dennis schütz
  • 383
  • 4
  • 21
  • Try reading that error again. What does that have to do with converters. Looks like your missing a reference to your DataLayer project – Viv Jun 12 '13 at 07:09
  • yes but im not allowed to use the reference of DataLayer on the client site – dennis schütz Jun 12 '13 at 07:27

2 Answers2

1

Where is your 'HGERP.Data.ArbeitsplatzGruppe' class defined? If it is in another dll or project you will need to reference that specific dll or project from your mvc project. You can right click the references section to add an assembly reference.

bbqchickenrobot
  • 3,592
  • 3
  • 45
  • 67
0

You likely need some pre-compiler directives around your data access code and relevant using statements, like

#if !SILVERLIGHT
using MyProject.DataAccess;
#endif

Otherwise, the SL business project will be looking for references it can't have.

Joe
  • 1,295
  • 13
  • 16