This is a migrated thread and some comments may be shown as answers.

Where is 'Enable project to use ORM'?

4 Answers 130 Views
Getting Started
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
CarlosLima
Top achievements
Rank 1
CarlosLima asked on 29 Sep 2010, 12:26 PM
I've downloaded the latest trial and was using the document (openaccess-madeeasy.pdf) to start a console application as the document says and the option doesn't appear on the menu. I only have 'Add domain model', 'Add domain service', 'upgrade references', 'help', 'options' and 'info'.

I'm using VS2010, .net 3.5 and also tried with 4.0.

Thanks.
Carlos

4 Answers, 1 is accepted

Sort by
0
IT-Als
Top achievements
Rank 1
answered on 29 Sep 2010, 01:31 PM
Hi Carlos,

That's because the document your are reading is written for the old API aka "OpenAccess ORM Classic". While this API is still working and being used a new API has arrived with the Visual Designer introduced earlier this year aka "OpenAccess ORM Visual Designer"
The documentation reflects this:
OpenAccess docs

If you are evaluating or beginning a new project I would definitely go for the "Visual Designer" API.

The link above and the section "OpenAccess ORM Classic" should be enough to get you started.

Regards

Henrik
0
CarlosLima
Top achievements
Rank 1
answered on 29 Sep 2010, 01:56 PM
Thanks.

I still have a problem:

I'm using Oracle DB and if I add the tables to the model, everything works fine but I have created a stored procedure on the DB using this code:

create or replace procedure PRC_GET_MENUS(MENUS_CUR out sys_refcursor) is
begin
  OPEN MENUS_CUR FOR select app_menu.menu_id,
       app_menu.context_tag_id,
       app_menu.display_order,
       app_menu_item.menu_item_id,
       app_menu_item.context_tag_id,
       app_menu_item.action,
       app_menu_item.display_order,
       app_menu_item.lock_type,
       app_menu_item.visible
  from app_menu,
       app_menu_item
 where (app_menu.menu_id = app_menu_item.menu_id) AND (app_menu_item.visible = 'A')
order by app_menu.display_order,
      app_menu_item.display_order;
end PRC_GET_MENUS;

(basically returns a table with the columns of two tables... menu and for each menu, it's menu items)

When I add this stored procedure to the model, I end up with this error:

Error   2   Running transformation: System.ArgumentNullException: Value cannot be null.
Parameter name: value
   at System.RuntimeType.GetEnumName(Object value)
   at System.Enum.GetName(Type enumType, Object value)
   at Telerik.OpenAccess.CodeGeneration.MetaModelCodeGenUtilities.ConvertStoredProcedureParameterToCodeParameter(MetaStoredProcedureParameter parameter)
   at Telerik.OpenAccess.CodeGeneration.MetaModelCodeGenUtilities.GetCodeParametersFromStoredProcedureParameters(List`1 parameterList)
   at Telerik.OpenAccess.CodeGeneration.MetaModelCodeGenUtilities.GetCodeFunction(MetaStoredProcedure procedure)
   at Telerik.OpenAccess.CodeGeneration.MetaModelCodeGenUtilities.<GetContextCodeFunctions>d__3.MoveNext()
   at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
   at Telerik.OpenAccess.CodeGeneration.MetaModelCodeGenUtilities.GetModelContextCodeClass(MetadataContainer modelClass, MetaModel dslModel)
   at Microsoft.VisualStudio.TextTemplating2F8B83347C856C1D0C5CF0BA23602542.GeneratedTextTransformation.InitializeTemplateGeneration() in c:\Program Files (x86)\Telerik\OpenAccess ORM\dsl\CodeGenerationTemplates\CSharp\Includes\General.ttinclude:line 26
   at Microsoft.VisualStudio.TextTemplating2F8B83347C856C1D0C5CF0BA23602542.GeneratedTextTransformation.TransformText() in c:\Users\calima\Documents\Visual Studio 2010\Projects\ConsoleApplication1\ConsoleApplication1\EntityDiagrams.rlinq:line 75
   at Microsoft.VisualStudio.TextTemplating.TransformationRunner.RunTransformation(TemplateProcessingSession session, String source, ITextTemplatingEngineHost host, String& result)        1   1  


Any idea why? The stored procedure only returns a cursor. The orm supports cursors for oracle right?


0
IT-Als
Top achievements
Rank 1
answered on 29 Sep 2010, 02:00 PM
Hi Carlos,

I am sorry. I can't help you any further since I have not used the ORM against Oracle (tables only - not SPs).

Anyone else who can elaborate on the error?

Regards

Henrik
0
Jan Blessenohl
Telerik team
answered on 11 Oct 2010, 04:08 PM
Hello Carlos,
OpenAccess supports one Cursor in an Oracle stored procedure call, but it looks like our reverse mechanism does not work in that case. We will fix that. In the meantime you can write this method by your self.

First you have to extend the generated context class, please add a new class with the same name as your context class, mark it as partial in the code and add this two funtions:

public partial class DatabaseContext // partial enhancement to generated context classs
{
    public Telerik.OpenAccess.Query<T> GetSqlQuery<T>(string sqlexpression, string parameter)
    {
        return GetScope().GetSqlQuery<T>(sqlexpression, parameter);
    }
    public Telerik.OpenAccess.IQuery GetSqlQuery(string sqlexpression, Type type, string parameter)
    {
        return GetScope().GetSqlQuery(sqlexpression, type, parameter);
    }
}

Now you have the full flexibilty to call any sql statement. To see the configuration of the call please have a look here. The OUT.CURSOR setting is only valid for Oracle, you can specify it once only. The return of this out cursor parameter is passed to you as result of the execute call, not inside the out value dictionary.

Best wishes,
Jan Blessenohl
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Getting Started
Asked by
CarlosLima
Top achievements
Rank 1
Answers by
IT-Als
Top achievements
Rank 1
CarlosLima
Top achievements
Rank 1
Jan Blessenohl
Telerik team
Share this question
or