This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
It appears that DateTimeOffset types from SQL 08 are not supported. Correct? |
|
|
Hi Peter, In what regard? In the designer or in the core? Cheers, - JD P.S. Was good catch up with you in Christchurch :-) |
|
|
Hiya Hmmm, not sure about the core but in the designer, tables come through with Object properties rather than DateTime or DateTimeOffset. Stored procs wont import at all. I dont really understand these types yet - never had to use them before. But I just cast the column to a date time for the stored proc now works. I should be able to change the entity to a date time also.
Cheers
|
|
|
Hi Peter, To avoid cluttering the Data Type drop-down, the designer only offers a set of "common" types. (For some value of "common." Nobody mention Int32Array or StringArray. *ahem*) For certain database providers, LightSpeed 3 extends this with provider-specific types such as SqlGeography and SqlGeometry. However, we don't necessarily add every provider-specific type (again, to reduce clutter). In this case, what you can do is add your own type definition to the model. Here's what to do (requires LightSpeed 3): * Go into the LightSpeed Model explorer (View > Other Windows > LightSpeed Model if it's not already open). * Right-click the model node and choose Add New User-Defined Type. * Select the new UDT node and go to the Properties window. * Change Name to DateTimeOffset. (Or anything else: this is just the display name within the LightSpeed designer.) * Change CLR Type Name to System.DateTimeOffset. (Required for the generated code.) * Change Is Standard Data Type to False. (Required to get at the Database Type Name option. (You'd leave this as True if you were mapping a 'normal' data type like Int32 to a custom CLR type like an enum.)) * Change Database Type Name to datetimeoffset. (Required for database sync.) You should now be able to drag on tables with datetimeoffset columns and have them correctly inferred as DateTimeOffset properties (or, if you already have entities with Object properties, you can change them to DateTimeOffset properties). Please let us know if you run into any bugs with this. Also, if you feel DateTimeOffset is a sufficiently useful type to deserve automatic support in the SQL Server provider, we're open to feedback on this or any other SQL08-specific types that you're working with. |
|
|
Cool, that seems to work. Thanks Ivan. |
|
|
FYI we'll be adding built-in support for DateTimeOffset in RTM. This may fight with a model-level user-defined type, so you may need to remove that UDT when RTM comes out (but your model should continue to work using the provider-defined DateTimeOffset UDT). |
|
|
FYI, dragging on a stored proc that returns a datetimeoffset in a column still fails but tables drag on ok.
Exception while processing Server Explorer drag: System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.VisualStudio.Modeling.DomainRoleInfo.GetLinkedElement(ModelElement rolePlayerElement, Guid domainRoleId) at Microsoft.VisualStudio.Modeling.Diagrams.PresentationViewsSubject.GetSubject(PresentationElement element) at Microsoft.VisualStudio.Modeling.Diagrams.PresentationElement.get_ModelElement() at Mindscape.LightSpeed.Generator.Integration.LightSpeedModelDiagram.GetDropTarget(Model model, PointD dropLocation) at Mindscape.LightSpeed.Generator.Integration.DiagramDragDropHandler.<>c__DisplayClass4.<OnDragDrop>b__3(DragObject dragObject, IGenerationLog log) at Mindscape.LightSpeed.Generator.Integration.ServerExplorer.IfIsServerExplorerDrag(DragEventArgs e, DragAction action) Exception while processing Server Explorer drag: System.NullReferenceException: Object reference not set to an instance of an object. at Mindscape.LightSpeed.Generator.Integration.LightSpeedModelDiagram.PointFromScreen(Int32 dropX, Int32 dropY) at Mindscape.LightSpeed.Generator.Integration.DiagramDragDropHandler.<>c__DisplayClass4.<OnDragDrop>b__3(DragObject dragObject, IGenerationLog log) at Mindscape.LightSpeed.Generator.Integration.ServerExplorer.IfIsServerExplorerDrag(DragEventArgs e, DragAction action) Exception while processing Server Explorer drag: System.ArgumentException: Unknown type System.DateTimeOffset Parameter name: clrType at Mindscape.LightSpeed.Generator.Extraction.Provider.GetModelDataType(Type clrType) at Mindscape.LightSpeed.Generator.Extraction.SqlServerExtractorBase.ExtractSelectProcedure(SqlDataReader reader, ProcedureName procedureName) at Mindscape.LightSpeed.Generator.Extraction.SqlServerExtractorBase.ExtractProcedure(SqlDataReader reader, ProcedureName procedureName) at Mindscape.LightSpeed.Generator.Extraction.SqlServerExtractorBase.<ExtractProcedures>d__d.MoveNext() at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) at Mindscape.LightSpeed.Generator.Extraction.Provider`1.ExtractProcedures(IEnumerable`1 procedureNames) at Mindscape.LightSpeed.Generator.Integration.ProcedureBuilder.AddProceduresToModel(Model model, ILightSpeedDataSource connection, IEnumerable`1 procedureNames, IGenerationLog log) at Mindscape.LightSpeed.Generator.Integration.DiagramDragDropHandler.<>c__DisplayClass4.<OnDragDrop>b__3(DragObject dragObject, IGenerationLog log) at Mindscape.LightSpeed.Generator.Integration.ServerExplorer.IfIsServerExplorerDrag(DragEventArgs e, DragAction action) |
|