This is really annoying...and I know it is something extremely simple...
1. I create a new Dynamic Data project.
2. I add a LINQ-to-SQL class and drag and drop some tables onto the class.
3. I open the global.asax.vb and uncomment the line:
DefaultModel.RegisterContext(GetType(YourDataContext), New ContextConfiguration() With {.ScaffoldAllTables = True})
I remove YourDataContext and replace it with the DataContext from my LINQ-to-SQL class:
DefaultModel.RegisterContext(GetType(NorthwindDataContext), New ContextConfiguration() With {.ScaffoldAllTables = True})
I then try to debug/build/etc. and receive the following error:
Type 'NorthwindDataContext' is not defined
Why is it not defined? It seems like its not recognizing I created the DBML file.
This is a very strange issue and I am still not sure that I have entirely fixed the issue. But, here is what I think I have learned:
1. If you are creating a New Project in VS2010 you must place the LINQ-to-SQL DBML file in the root project directory.
2. If you are creating a new Web Site in VS2010 you must place the LINQ-to-SQL DBML file in a newly created App_Code directory.
3. If you place it in the wrong place, scrap the project and start over - it doesn't seem to work even if you move the files to the correct location or recreate them in the correct location.
Dave.
Does your project compile? I am guessing you are missing the namespace to your data context. Something like this:
model.RegisterContext(typeof(MyApp.MyNamespace.NorthwindDataContext),
new ContextConfiguration() { ScaffoldAllTables = true });
Related
I am testing the azure-devops-migration-tools and have create a project using https://azuredevopsdemogenerator.azurewebsites.net/ (Parts Unlimited). I have generated the configuration.json and changed the Source and Target so I can test a migration, but I'm getting errors while migrating Work Items.
[15:14:41 ERR] Error running query
Microsoft.TeamFoundation.WorkItemTracking.Client.ValidationException: TF51005: The query references a field that does not exist. The error is caused by «ReflectedWorkItemId».
I've tried different options on the "ReflectedWorkItemIDFieldName" field, Scrum, Basic, Agile, Custom, empty but am still unable to migrate the work items.
How can I get the value to put on this field for the specific project?
Thanks,
Bruno
Quick Solution: Most ADO instances use the prefix 'custom' for new fields. Try "Custom.ReflectedWorkItemId" in your configuration.json to see if that resolves the problem.
More details: It's hard to tell without an actual configuration.JSON file to review. One possible problem is that you need to use the actual and full internal 'Name' of the ReflectedWorkItemID field. This doesn't show in ADO, or the Process Template when created. The recommendation is that you create a query referencing your custom field, and export the WIQL file (query file). Once you export the WIQL file, you can then open the file and see the full syntax of the custom field.
Exporting Queries: If you don't know how to do this, it can be done with VisualStudio. If you don't know how to do that, you can install this extension. It's a handy WIQL import/Export and editor. Install, and your ADO Queries with have an Edit in WIQL Editor option. Create a query that exposes your 'ReflectedWorkItemID' as a column, then edit that query in the WIQL editor and see the full names of the Reflected Work Items ID Feild. https://marketplace.visualstudio.com/items?itemName=ottostreifel.wiql-editor
SELECT
[System.Id],
[System.WorkItemType],
[System.Title],
[System.AssignedTo],
[System.ChangedBy],
[Custom.ReflectedWorkItemId]
FROM workitems
WHERE ...
I found a possible solution. I have created a custom process, change the process from the projects to this new one and add a new field. This is the field I'm using on the configuration.json and now I'm able to migrate work items
To make the migration in the "ReflectedWorkItemIDFieldName" you must do:
"Organization Settings" -> Process -> Select the process where you project are (Basic, Scrum, Agil, or CMMI).
then click on the 3 dots and create a new Inherited process.
Then with the inherited process, you are able to create a new field for each work item type. The name that you type (could be "IronMan") that name will be in your configuration file.
I am new to vb.net and I'm having trouble viewing this class that someone has made.
The link to the class is:
http://www.vbforums.com/attachment.php?attachmentid=86867&d=1323127879
I did the following steps:
1. Create a new project with a form
2. Add the above class
3. Create an object of the class in my form load sub as:
Dim newClass As VisualStudiosTabControl = New VisualStudiosTabControl
But when i try to run it I get a whole bunch of build errors like:
Type 'System.Windows.Forms.Design.ScrollableControlDesigner' is not defined.
and
'Control' is not a member of 'Tab_Control_Example.VisualStudiosTabControl.VisualStudiosTabPage.VisualStudiosTabDesigner'.
Please help me.
Thanks
You are missing many of the parent files and this looks to be designed to be added onto a project. Try to load whiten your solution of your project.
Is it possible to add to a CustomMboSet in Maximo using scripting? I am writing a custom application using a custom object called TIMESHEET. As part of the application I am writing a (Jython) script that needs to dynamically build up an MboSet (a set of TIMESHEETs). The code retrieves an existing CustomMboSet and attempts to add elements to it. It works when using an out of box MboSet, but when I try to run the same code on a custom MboSet it does not seem to work. No error is thrown, but code below the offending line is not run.
In other words, this works (LABTRANS is an out of box MBO):
myMboSet = mbo.getMboSet("LABTRANS")
newMbo = myMboSet.add()
# Set attributes on newMbo, everything is happy
But this does not (TIMESHEET is a custom MBO):
myMboSet = mbo.getMboSet("TIMESHEET")
newMbo = myMboSet.add()
# Code does not execute after the above line
Anyone have any insight as to why I am seeing this behavior? Does the Maximo scripting framework simply not support the dynamic building up of CustomMboSets? Any help is appreciated. Thanks.
You need to make sure that the relationship exists between the Current MBO and the Custom MBO in the database configuration otherwise it will not work.
Alternatively you can use the following code to create an new mboSet on the fly:
timeSheetMboSet = mxServer.getMboSet("TIMESHEET", userInfo)
mbo.getMboSet(RELATIONSHIPNAME).
LABTRANS and TIMESHEET must be the relationship names to the object in auto script.
If you want to get/add records in any object, use
mxServer.getMboSet(OBJECTNAME, userInfo)
A bit more explanation. You can create your own custom relationship from within your automation script. The trick is to make sure it's not already existing. That's why I use a dollar sign for mine.
variable = mbo.getMboSet(tempRelationshipName,Object,where clause)
previousPhaseSet = mbo.getMboSet("$wophasetranstemp1", "exitdate is null")
I have an issue with CF9 ORM mapping.
I get the following error from time to time (yes, it works fine most of the time),
Mapping for component model.Pubs not found. Either the mapping for this component is missing or the application must be restarted to generate the mapping.
ORM definition in Application.cfc
<cfscript>
this.datasource = "Pubs";
this.ormenabled = true;
this.ormsettings= {
dialect="MicrosoftSQLServer",
dbcreate="update",
eventhandling="true"
};
</cfscript>
<cfset this.mappings["/model"] = getDirectoryFromPath(getCurrentTemplatePath()) & "model" />
The only way to fix it is to refresh the ORM couple of time, which is by hitting ?init=true on Application.cfc. It is still a temporary solution, but I need to know the root cause of it and fix it.
<cfscript>
if(structKeyExists(url, "init")) { ormReload(); applicationStop(); location('index.cfm?reloaded=true'); }
Please advise.
Thanks!
I also had your problem, but now it works fine. First, if you don't set ormsettings.cfclocation, ColdFusion does this:
If it is not set, ColdFusion looks at the application directory, its sub-directories, and its mapped directories to search for persistent CFCs. (see Spec)
This is error prone, because you never know what ColdFusion finds in all that directories.
When you add cfclocation to your example it should work:
this.ormsettings= {
cfclocation = ["/model", "/other/entities", "/more/other/entites"]
}
There is a lot of discussion out there, about how to specify the paths for cfclocation. For me, that way works.
But the first element of my cfclocation is always an application mapping, like your this.mappings["/model"]. I have not tested it with webserver aliases or CFCs in the webroot, without mapping. You should also avoid colliding namespaces, like a "model" directory in the webroot, while having a "/model" mapping.
Good luck:)
Okay, thank you both #Henry and #Walter for your comments. They were the lead toward the right solution.
Here's what I did to make sure it's stable ALL the time.
I used one folder (location) for all ORM CFCs. There used to be a "model" folder for each section. Sections are sibling folders under one root and share the same Application.cfc.
I changed that to ONE root level folder for all CFCs, ie: /root/ormmodel
On the /root/Application.cfc, I adjusted the following code
<cfset application.mappings["/ormmodel"] = expandPath("/root/ormmodel") />
and
this.ormsettings= {
cfclocation = ["ormmodel"],
autogenmap = true,
...
eventhandling="true"
};
Notice the missing "/" in the cfclocation value.
On calling for model components, I changed the code from pub = new ormmodel.Pubs() to
pub = EntityNew("Pubs");
On an unrelated point, I've changed my components name to camelCase naming and avoided special characters like underscores and dashes.
I hope this would be helpful and save someone else hours of frustration and suspense.
Happy coding!
I recently started using LINQPad to test bits and pieces and its a great time saver.
However, sometimes it gives me some errors with minor things.
when I want to test this:
HttpUtility.UrlPathEncode("Make sure");
I get this error: The name 'HttpUtility' does not exist in the current context.
Is there a way to get it to recognize basic stuff like HttpUtility?
I just tried writing:
System.Web.HttpUtility.UrlPathEncode("Make sure")
and I am shown this: The type or namespace name 'HttpUtility' does not exist in the namespace 'System.Web'
You need to a reference System.Web.dll. Press F4 (References) and add a reference to that DLL.
Or, if you have an autocompletion license, just type your original query:
HttpUtility.UrlPathEncode("Make sure");
and open the smart-tag that automatically appears. It will present a menu option to add the reference to System.Web.dll and import the System.Web namespace in a one-fell-click!