Use IFace for Pocket3D in Eyeshot - c#

I'm trying to use the Pocket3D() function. To do this you need to define a Geomtry3D() with the "entList as IFace()" or "Geometry as IFace" constructor.
The idea is to select one or more GBrep.Face and create the Geometry3D() .
My problem is that I have no idea how to get this IFace from GBrep.Face?????
I have no idea what to try. I can't do anything with this iface.
Many Thanks

Related

Why are some AutomationPeer are sealed?

I have a DataGrid where an additional parameter exists at a DataGridRow. I want to test this parameter with FlaUi. I have already read up a bit on AutomationPeers. As far as I understand you have to create a new AutomationPeer and make the parameter available there. My problem is that the DataGridRowAutomationPeer is seald and I can't derive from it. Does anyone know why MS did this? And is there possibly a simpler variant?
Thanks in advance :-)

VS Code: Extract interface in C#

I'm using VS Code and I can't figure out if it's possible to take a class and extract an interface from it. When I google how to do this, I only find extensions for TypeScript, but I want to do this in C#.
Can VS Code extract interfaces? Knowing the shortcut would be nice for others, but I'm using a different keymap, so I'd like to know how to do this from the menu.
You may try this,
Move your cursor on the class_name that you want to extract interface. Then Ctrl + . (period)
Then choose "Extract Interface" this will generate a code above the class that you want to be extracted.
Then move your cursor the interface class_name Ctrl + . (period) again, then choose "Move type to the" auto-generated class name then that's it.
Hope this will help you guys and for future reference.
Not really sure if this feature was already there or got implemented afterwards, but I found this:
First, extract the interface as usual
Then you get to do this on your methods:
Note that it doesn't add necessary usings but uses namespaces instead. You can do the clean up as you like.

Updating Code, Find All Objects Of Type

Task:
Rip through all the code in the entire solution and wrap all webservice method-calls in another ws method-call that accepts a GUID (it's a login scenario)
Background :
Hundreds of web services, add token security. As explained to me when I was assigned to the task, we do it this way because if, in the future , some changes to security etc have to be made we can just do it in the WrappermethodClass in stead of having to change hundreds of web services
Tried and failed :
Find all references : too much data , returned more than 1000 hits , most of which are useless as they're only object references.
Rename WS so all references beak, build the project I'm working on and fix as I go : works well with the services not integral to the functionality but as soon as I do it with an important one it's like I shot the Solution through the brain, everything's f****d and and VS just gives up trying.
Current Solution :Open all relevant docs, Find ,select All Open Docs, skip through.
Question : How do I do this as efficiently as possible?
Code (before) :
wsGeneric wsGen = new wsGeneric();
wsGen.DoSomething();
Code (after) :
WrapperMethodClass.DoCheck takes params of (Action, GUID),
wsGeneric wsGen = new wGeneric();
wrapperMethodClass.DoCheck((g) =>
{ wsGen.UserInfo.token = g.ToString();
wsGen.DoSomething();
},Shell.token.Value);
Don´t you have some sort of interface or class where you changed the method signature already?
If you changed your webservice and your Code still compiles i´d say you did something wrong or i don´t understand the question.
Update:
I still don´t get it.
I think you have these options:
Change the method signature (all calls should be broken now, fix all the errors vs gives you and you should be done)
Find all references (of the method, not your webservice-class) and change the calls
If above isn´t possible use "Find in Files" and search for the method-name
If all your webservices inherit from an interface or base class you can refactor this method to add a parameter, all inheriting classes will also have the parameter.
If you pass a login object to each webservice, you can add a GUID element to this object and you're done.
It would be a lot easier if you showed us some code, some function interfaces that you have to change and how.
A better solution may be to just use PostSharp to add the checks to your services. This will solve your business problem (you only need to update your aspects) and is much less error prone then your current approach since you don't have to wory about some new developer forgetting to make the call to DoCheck.
Not having to find all references is a side benefit.

How to get single object when using repository pattern?

I'm using a homebrewed repository pattern (!) together with PetaPoco in my latest project. And when coding some data retrieval routines my brain suddenly made a jump.
Currently i have Repo.GetMyObjects that returns an IList<MyObject> from the db, and a Repo.GetMyObject that returns a MyObject.
Is this the correct way to go ahead? Or should I have my Repo.GetMyObjects return an IEnumerable<MyObject> and then use Repo.GetMyObjects().SingleOrDefault( q => q.ID == MyWantedObjectID) in my controller to get a single object?
To go even further than Ankur's answer: the way you are doing is actually more correct, because having to add SingleOrDefault() calls would seem to be something the repository should be doing for you.
Let your Repo.GetMyObject bet there and make it do what you have described. So that in future if required you can change the implementation and all the callers won't need any change.
It would be stupid to retrieve a whole collection of MyObject instances, if you only need one. Consider the performance-cost that this gives you, if you have thousands of instances in your database.
So, you'll need a GetMyObject method in your repository, which retrieves the only object you're interested in.

entityFramework CreateSourceQuery

Im using SelfTrackingChanges and on relationship end "MANY" I havent got CreateSourceQuery() method :/
Is there any way I can achieve that still using SelfTrackingChanges ?
thanks for any help
Only EntityCollection<TEntity> and EntityReference<TEntity> classes override the IRelatedEnd.CreateSourceQuery as they implement IRelatedEnd interface and they both found on the EntityObjects which means you don't have it on your STEs and POCOs. What are you really trying to accomplish?

Categories

Resources